Index: /palm/trunk/SCRIPTS/mrun
===================================================================
--- /palm/trunk/SCRIPTS/mrun	(revision 1319)
+++ /palm/trunk/SCRIPTS/mrun	(revision 1320)
@@ -22,5 +22,5 @@
 # Current revisions:
 # ------------------
-# 
+# check namelist file set false by default
 # 
 # Former revisions:
@@ -166,5 +166,5 @@
  archive_save=true
  archive_system=none
- check_namelist_files=true
+ check_namelist_files=false
  combine_plot_fields=true
  compiler_name=""
Index: /palm/trunk/SOURCE/Makefile
===================================================================
--- /palm/trunk/SOURCE/Makefile	(revision 1319)
+++ /palm/trunk/SOURCE/Makefile	(revision 1320)
@@ -20,5 +20,5 @@
 # Current revisions:
 # ------------------
-# 
+# +mod_kinds in dependency list
 #
 # Former revisions:
@@ -170,7 +170,7 @@
 	lpm_set_attributes.f90 lpm_sort_arrays.f90 \
 	lpm_write_exchange_statistics.f90 lpm_write_restart_file.f90 \
-   ls_forcing.f90 message.f90 microphysics.f90 modules.f90 mod_kinds.f90 \
-   netcdf.f90 nudging.f90 \
-   package_parin.f90 palm.f90 parin.f90 plant_canopy_model.f90 poisfft.f90 \
+	ls_forcing.f90 message.f90 microphysics.f90 modules.f90 mod_kinds.f90 \
+	netcdf.f90 nudging.f90 \
+	package_parin.f90 palm.f90 parin.f90 plant_canopy_model.f90 poisfft.f90 \
 	poismg.f90 prandtl_fluxes.f90 pres.f90 print_1d.f90 \
 	production_e.f90 prognostic_equations.f90 random_function.f90 \
@@ -224,163 +224,167 @@
 
 
-advec_s_bc.o: modules.o cpulog.o
-advec_s_pw.o: modules.o
-advec_s_up.o: modules.o
-advec_u_pw.o: modules.o
-advec_u_up.o: modules.o
-advec_v_pw.o: modules.o
-advec_v_up.o: modules.o
-advec_ws.o: modules.o
-advec_w_pw.o: modules.o
-advec_w_up.o: modules.o
-average_3d_data.o: modules.o cpulog.o
-boundary_conds.o: modules.o
-buoyancy.o: modules.o
-calc_liquid_water_content.o: modules.o
-calc_precipitation.o: modules.o
-calc_radiation.o: modules.o
-calc_spectra.o: modules.o cpulog.o fft_xy.o
-check_for_restart.o: modules.o
-check_open.o: modules.o
-check_parameters.o: modules.o subsidence.o
-close_file.o: modules.o
-compute_vpt.o: modules.o
-coriolis.o: modules.o
-cpulog.o: modules.o
-cpu_statistics.o: modules.o
-cuda_fft_interfaces.o: cuda_fft_interfaces.f90 modules.o
-data_log.o: modules.o
-data_output_dvrp.o: modules.o cpulog.o
-data_output_mask.o: modules.o cpulog.o
-data_output_profiles.o: modules.o cpulog.o
-data_output_ptseries.o: modules.o cpulog.o
-data_output_spectra.o: modules.o cpulog.o
-data_output_tseries.o: modules.o cpulog.o
-data_output_2d.o: modules.o cpulog.o
-data_output_3d.o: modules.o cpulog.o
-diffusion_e.o: modules.o
-diffusion_s.o: modules.o
-diffusion_u.o: modules.o wall_fluxes.o
-diffusion_v.o: modules.o wall_fluxes.o
-diffusion_w.o: modules.o wall_fluxes.o
-diffusivities.o: modules.o
-disturb_field.o: modules.o cpulog.o random_function.o
-disturb_heatflux.o: modules.o
-eqn_state_seawater.o: modules.o
-exchange_horiz.o: modules.o cpulog.o
-exchange_horiz_2d.o: modules.o cpulog.o
-fft_xy.o: cuda_fft_interfaces.o modules.o singleton.o temperton_fft.o
-flow_statistics.o: modules.o cpulog.o
-global_min_max.o: modules.o
-header.o: modules.o cpulog.o subsidence.o
-impact_of_latent_heat.o: modules.o
-inflow_turbulence.o: modules.o cpulog.o
-init_1d_model.o: modules.o
-init_3d_model.o: modules.o cpulog.o random_function.o advec_ws.o ls_forcing.o
-init_advec.o: modules.o
-init_cloud_physics.o: modules.o
-init_coupling.o: modules.o
-init_dvrp.o: modules.o
-init_grid.o: modules.o
-init_masks.o: modules.o
-init_ocean.o: modules.o eqn_state_seawater.o
-init_pegrid.o: modules.o
-init_pt_anomaly.o: modules.o
-init_rankine.o: modules.o
-init_slope.o: modules.o
-interaction_droplets_ptq.o: modules.o
-local_getenv.o: modules.o
-local_stop.o: modules.o
-local_tremain.o: modules.o cpulog.o
-local_tremain_ini.o: modules.o cpulog.o
-lpm.o: modules.o cpulog.o
-lpm_advec.o: modules.o
-lpm_boundary_conds.o: modules.o cpulog.o
-lpm_calc_liquid_water_content.o: modules.o cpulog.o
-lpm_collision_kernels.o: modules.o cpulog.o user_module.o
-lpm_data_output_particles.o: modules.o cpulog.o
-lpm_droplet_collision.o: modules.o cpulog.o lpm_collision_kernels.o
-lpm_droplet_condensation.o: modules.o cpulog.o lpm_collision_kernels.o
-lpm_exchange_horiz.o: modules.o cpulog.o
-lpm_extend_particle_array.o: modules.o
-lpm_extend_tails.o: modules.o
-lpm_extend_tail_array.o: modules.o
-lpm_init.o: modules.o lpm_collision_kernels.o random_function.o
-lpm_init_sgs_tke.o: modules.o
-lpm_pack_arrays.o: modules.o
-lpm_read_restart_file.o: modules.o
-lpm_release_set.o: modules.o random_function.o
-lpm_set_attributes.o: modules.o cpulog.o
-lpm_sort_arrays.o: modules.o cpulog.o
-lpm_write_exchange_statistics.o: modules.o
-lpm_write_restart_file.o: modules.o
-ls_forcing.o: modules.o cpulog.o
-message.o: modules.o
-microphysics.o: modules.o
-modules.o: modules.f90
-netcdf.o: modules.o
-nudging.o: modules.o buoyancy.o cpulog.o
-package_parin.o: modules.o
-palm.o: modules.o cpulog.o ls_forcing.o nudging.o
-parin.o: modules.o cpulog.o
-plant_canopy_model.o: modules.o
-poisfft.o: modules.o cpulog.o fft_xy.o tridia_solver.o
-poismg.o: modules.o cpulog.o
-prandtl_fluxes.o: modules.o
-pres.o: modules.o cpulog.o poisfft.o
-print_1d.o: modules.o cpulog.o
-production_e.o: modules.o wall_fluxes.o
+advec_s_bc.o: modules.o cpulog.o mod_kinds.o
+advec_s_pw.o: modules.o mod_kinds.o
+advec_s_up.o: modules.o mod_kinds.o
+advec_u_pw.o: modules.o mod_kinds.o
+advec_u_up.o: modules.o mod_kinds.o
+advec_v_pw.o: modules.o mod_kinds.o
+advec_v_up.o: modules.o mod_kinds.o
+advec_ws.o: modules.o mod_kinds.o
+advec_w_pw.o: modules.o mod_kinds.o
+advec_w_up.o: modules.o mod_kinds.o
+average_3d_data.o: modules.o cpulog.o mod_kinds.o
+boundary_conds.o: modules.o mod_kinds.o
+buoyancy.o: modules.o mod_kinds.o
+calc_liquid_water_content.o: modules.o mod_kinds.o
+calc_precipitation.o: modules.o mod_kinds.o
+calc_radiation.o: modules.o mod_kinds.o
+calc_spectra.o: modules.o cpulog.o fft_xy.o mod_kinds.o
+check_for_restart.o: modules.o mod_kinds.o
+check_open.o: modules.o mod_kinds.o
+check_parameters.o: modules.o mod_kinds.o subsidence.o
+close_file.o: modules.o mod_kinds.o
+compute_vpt.o: modules.o mod_kinds.o
+coriolis.o: modules.o mod_kinds.o
+cpulog.o: modules.o mod_kinds.o
+cpu_statistics.o: modules.o mod_kinds.o
+cuda_fft_interfaces.o: cuda_fft_interfaces.f90 modules.o mod_kinds.o
+data_log.o: modules.o mod_kinds.o
+data_output_dvrp.o: modules.o cpulog.o mod_kinds.o
+data_output_mask.o: modules.o cpulog.o mod_kinds.o
+data_output_profiles.o: modules.o cpulog.o mod_kinds.o
+data_output_ptseries.o: modules.o cpulog.o mod_kinds.o
+data_output_spectra.o: modules.o cpulog.o mod_kinds.o
+data_output_tseries.o: modules.o cpulog.o mod_kinds.o
+data_output_2d.o: modules.o cpulog.o mod_kinds.o
+data_output_3d.o: modules.o cpulog.o mod_kinds.o
+diffusion_e.o: modules.o mod_kinds.o
+diffusion_s.o: modules.o mod_kinds.o
+diffusion_u.o: modules.o mod_kinds.o wall_fluxes.o
+diffusion_v.o: modules.o mod_kinds.o wall_fluxes.o
+diffusion_w.o: modules.o mod_kinds.o wall_fluxes.o
+diffusivities.o: modules.o mod_kinds.o
+disturb_field.o: modules.o cpulog.o mod_kinds.o random_function.o
+disturb_heatflux.o: modules.o mod_kinds.o
+eqn_state_seawater.o: modules.o mod_kinds.o
+exchange_horiz.o: modules.o cpulog.o mod_kinds.o
+exchange_horiz_2d.o: modules.o cpulog.o mod_kinds.o
+fft_xy.o: cuda_fft_interfaces.o modules.o mod_kinds.o singleton.o temperton_fft.o
+flow_statistics.o: modules.o cpulog.o mod_kinds.o
+global_min_max.o: modules.o mod_kinds.o
+header.o: modules.o cpulog.o mod_kinds.o subsidence.o
+impact_of_latent_heat.o: modules.o mod_kinds.o
+inflow_turbulence.o: modules.o cpulog.o mod_kinds.o
+init_1d_model.o: modules.o mod_kinds.o
+init_3d_model.o: modules.o cpulog.o mod_kinds.o random_function.o advec_ws.o ls_forcing.o
+init_advec.o: modules.o mod_kinds.o
+init_cloud_physics.o: modules.o mod_kinds.o
+init_coupling.o: modules.o mod_kinds.o
+init_dvrp.o: modules.o mod_kinds.o
+init_grid.o: modules.o mod_kinds.o
+init_masks.o: modules.o mod_kinds.o
+init_ocean.o: modules.o eqn_state_seawater.o mod_kinds.o
+init_pegrid.o: modules.o mod_kinds.o
+init_pt_anomaly.o: modules.o mod_kinds.o
+init_rankine.o: modules.o mod_kinds.o
+init_slope.o: modules.o mod_kinds.o
+interaction_droplets_ptq.o: modules.o mod_kinds.o
+local_flush.o: mod_kinds.o
+local_getenv.o: modules.o mod_kinds.o
+local_stop.o: modules.o mod_kinds.o
+local_tremain.o: modules.o cpulog.o mod_kinds.o
+local_tremain_ini.o: modules.o cpulog.o mod_kinds.o
+lpm.o: modules.o cpulog.o mod_kinds.o
+lpm_advec.o: modules.o mod_kinds.o
+lpm_boundary_conds.o: modules.o cpulog.o mod_kinds.o
+lpm_calc_liquid_water_content.o: modules.o cpulog.o mod_kinds.o
+lpm_collision_kernels.o: modules.o cpulog.o user_module.o mod_kinds.o
+lpm_data_output_particles.o: modules.o cpulog.o mod_kinds.o
+lpm_droplet_collision.o: modules.o cpulog.o lpm_collision_kernels.o mod_kinds.o
+lpm_droplet_condensation.o: modules.o cpulog.o lpm_collision_kernels.o mod_kinds.o
+lpm_exchange_horiz.o: modules.o cpulog.o mod_kinds.o
+lpm_extend_particle_array.o: modules.o mod_kinds.o
+lpm_extend_tails.o: modules.o mod_kinds.o
+lpm_extend_tail_array.o: modules.o mod_kinds.o
+lpm_init.o: modules.o lpm_collision_kernels.o mod_kinds.o random_function.o
+lpm_init_sgs_tke.o: modules.o mod_kinds.o
+lpm_pack_arrays.o: modules.o mod_kinds.o
+lpm_read_restart_file.o: modules.o mod_kinds.o
+lpm_release_set.o: modules.o mod_kinds.o random_function.o
+lpm_set_attributes.o: modules.o cpulog.o mod_kinds.o
+lpm_sort_arrays.o: modules.o cpulog.o mod_kinds.o
+lpm_write_exchange_statistics.o: modules.o mod_kinds.o
+lpm_write_restart_file.o: modules.o mod_kinds.o
+ls_forcing.o: modules.o cpulog.o mod_kinds.o
+message.o: modules.o mod_kinds.o
+microphysics.o: modules.o mod_kinds.o
+modules.o: modules.f90 mod_kinds.o
+mod_kinds.o: mod_kinds.f90
+netcdf.o: modules.o mod_kinds.o
+nudging.o: modules.o buoyancy.o cpulog.o mod_kinds.o
+package_parin.o: modules.o mod_kinds.o
+palm.o: modules.o cpulog.o ls_forcing.o mod_kinds.o nudging.o
+parin.o: modules.o cpulog.o mod_kinds.o
+plant_canopy_model.o: modules.o mod_kinds.o
+poisfft.o: modules.o cpulog.o fft_xy.o mod_kinds.o tridia_solver.o
+poismg.o: modules.o cpulog.o mod_kinds.o
+prandtl_fluxes.o: modules.o mod_kinds.o
+pres.o: modules.o cpulog.o mod_kinds.o poisfft.o
+print_1d.o: modules.o cpulog.o mod_kinds.o
+production_e.o: modules.o mod_kinds.o wall_fluxes.o
 prognostic_equations.o: modules.o advec_s_pw.o advec_s_up.o advec_u_pw.o \
 	advec_u_up.o advec_v_pw.o advec_v_up.o advec_w_pw.o advec_w_up.o  \
    advec_ws.o buoyancy.o calc_precipitation.o calc_radiation.o coriolis.o \
 	cpulog.o diffusion_e.o diffusion_s.o diffusion_u.o diffusion_v.o diffusion_w.o \
-	eqn_state_seawater.o impact_of_latent_heat.o microphysics.o \
+	eqn_state_seawater.o impact_of_latent_heat.o mod_kinds.o microphysics.o \
         nudging.o plant_canopy_model.o production_e.o subsidence.o user_actions.o
-random_gauss.o: random_function.o
-read_3d_binary.o: modules.o cpulog.o random_function.o
-read_var_list.o: modules.o
-run_control.o: modules.o cpulog.o
-set_slicer_attributes_dvrp.o: modules.o
-singleton.o: singleton.f90
-sor.o: modules.o
-subsidence.o: modules.o
-sum_up_3d_data.o: modules.o cpulog.o
-surface_coupler.o: modules.o cpulog.o
-swap_timelevel.o: modules.o cpulog.o
-temperton_fft.o: modules.o
+random_function.o: mod_kinds.o
+random_gauss.o: mod_kinds.o random_function.o
+read_3d_binary.o: modules.o cpulog.o mod_kinds.o random_function.o
+read_var_list.o: modules.o mod_kinds.o
+run_control.o: modules.o cpulog.o mod_kinds.o
+set_slicer_attributes_dvrp.o: modules.o mod_kinds.o
+singleton.o: mod_kinds.o singleton.f90
+sor.o: modules.o mod_kinds.o
+subsidence.o: modules.o mod_kinds.o
+sum_up_3d_data.o: modules.o cpulog.o mod_kinds.o
+surface_coupler.o: modules.o cpulog.o mod_kinds.o
+swap_timelevel.o: modules.o cpulog.o mod_kinds.o
+temperton_fft.o: modules.o mod_kinds.o
 time_integration.o: modules.o advec_ws.o buoyancy.o cpulog.o interaction_droplets_ptq.o \
-	ls_forcing.o production_e.o prognostic_equations.o user_actions.o
-timestep.o: modules.o cpulog.o
-timestep_scheme_steering.o: modules.o
-transpose.o: modules.o cpulog.o
-tridia_solver.o: modules.o
-user_3d_data_averaging.o: modules.o user_module.o
-user_actions.o: modules.o cpulog.o user_module.o
-user_additional_routines.o: modules.o user_module.o
-user_check_data_output.o: modules.o user_module.o
-user_check_data_output_pr.o: modules.o user_module.o
-user_check_parameters.o: modules.o user_module.o
-user_data_output_2d.o: modules.o user_module.o
-user_data_output_3d.o: modules.o user_module.o
-user_data_output_mask.o: modules.o user_module.o
-user_data_output_dvrp.o: modules.o user_module.o
-user_define_netcdf_grid.o: modules.o user_module.o
-user_dvrp_coltab.o: modules.o user_module.o
-user_header.o: modules.o user_module.o
-user_init.o: modules.o user_module.o
-user_init_3d_model.o: modules.o user_module.o
-user_init_grid.o: modules.o user_module.o
-user_init_plant_canopy.o: modules.o user_module.o
-user_last_actions.o: modules.o user_module.o
-user_lpm_advec.o: modules.o user_module.o
-user_lpm_init.o: modules.o user_module.o
-user_lpm_set_attributes.o: modules.o user_module.o
-user_module.o: user_module.f90
-user_parin.o: modules.o user_module.o
-user_read_restart_data.o: modules.o user_module.o
-user_spectra.o: modules.o user_module.o
-user_statistics.o: modules.o user_module.o
-wall_fluxes.o: modules.o
-write_3d_binary.o: modules.o cpulog.o random_function.o
-write_compressed.o: modules.o
-write_var_list.o: modules.o
+	ls_forcing.o mod_kinds.o production_e.o prognostic_equations.o user_actions.o
+time_to_string.o: mod_kinds.o
+timestep.o: modules.o cpulog.o mod_kinds.o
+timestep_scheme_steering.o: modules.o mod_kinds.o
+transpose.o: modules.o cpulog.o mod_kinds.o
+tridia_solver.o: modules.o mod_kinds.o
+user_3d_data_averaging.o: modules.o mod_kinds.o user_module.o
+user_actions.o: modules.o cpulog.o mod_kinds.o user_module.o
+user_additional_routines.o: modules.o mod_kinds.o user_module.o
+user_check_data_output.o: modules.o mod_kinds.o user_module.o
+user_check_data_output_pr.o: modules.o mod_kinds.o user_module.o
+user_check_parameters.o: modules.o mod_kinds.o user_module.o
+user_data_output_2d.o: modules.o mod_kinds.o user_module.o
+user_data_output_3d.o: modules.o mod_kinds.o user_module.o
+user_data_output_mask.o: modules.o mod_kinds.o user_module.o
+user_data_output_dvrp.o: modules.o mod_kinds.o user_module.o
+user_define_netcdf_grid.o: modules.o mod_kinds.o user_module.o
+user_dvrp_coltab.o: modules.o mod_kinds.o user_module.o
+user_header.o: modules.o mod_kinds.o user_module.o
+user_init.o: modules.o mod_kinds.o user_module.o
+user_init_3d_model.o: modules.o mod_kinds.o user_module.o
+user_init_grid.o: modules.o mod_kinds.o user_module.o
+user_init_plant_canopy.o: modules.o mod_kinds.o user_module.o
+user_last_actions.o: modules.o mod_kinds.o user_module.o
+user_lpm_advec.o: modules.o mod_kinds.o user_module.o
+user_lpm_init.o: modules.o mod_kinds.o user_module.o
+user_lpm_set_attributes.o: modules.o mod_kinds.o user_module.o
+user_module.o: mod_kinds.o user_module.f90
+user_parin.o: modules.o mod_kinds.o user_module.o
+user_read_restart_data.o: modules.o mod_kinds.o user_module.o
+user_spectra.o: modules.o mod_kinds.o user_module.o
+user_statistics.o: modules.o mod_kinds.o user_module.o
+wall_fluxes.o: modules.o mod_kinds.o
+write_3d_binary.o: modules.o cpulog.o mod_kinds.o random_function.o
+write_compressed.o: modules.o mod_kinds.o
+write_var_list.o: modules.o mod_kinds.o
Index: /palm/trunk/SOURCE/Makefile_check
===================================================================
--- /palm/trunk/SOURCE/Makefile_check	(revision 1319)
+++ /palm/trunk/SOURCE/Makefile_check	(revision 1320)
@@ -20,5 +20,5 @@
 # Current revisions:
 # ------------------
-# 
+# cpu_log renamed cpulog, + mod_kinds in dependency list
 #
 # Former revisions:
@@ -69,9 +69,9 @@
 
 SOURCES = check_open.f90 check_namelist_files.f90 check_parameters.f90 \
-      close_file.f90 cpu_log.f90 cuda_fft_interfaces.f90 exchange_horiz.f90 \
+      close_file.f90 cpulog.f90 cuda_fft_interfaces.f90 exchange_horiz.f90 \
       exchange_horiz_2d.f90 fft_xy.f90 init_grid.f90 init_masks.f90 \
       init_cloud_physics.f90 init_pegrid.f90 local_flush.f90 local_stop.f90 \
-      local_system.f90 message.f90 modules.f90 package_parin.f90 parin.f90 \
-      poisfft.f90 random_function.f90 singleton.f90 \
+      local_system.f90 message.f90 modules.f90 mod_kinds.f90 package_parin.f90 \
+      parin.f90 poisfft.f90 random_function.f90 singleton.f90 \
       subsidence.f90 temperton_fft.f90 tridia_solver.f90 \
       user_3d_data_averaging.f90 user_actions.f90 \
@@ -115,52 +115,53 @@
 
 
-check_open.o: modules.o
-check_namelist_files.o: modules.o
-check_parameters.o: modules.o subsidence.o
-close_file.o: modules.o
-cpu_log.o: modules.o
-cuda_fft_interfaces.o: cuda_fft_interfaces.f90
-exchange_horiz.o: modules.o
-exchange_horiz_2d.o: modules.o
-fft_xy.o: cuda_fft_interfaces.o modules.o singleton.o temperton_fft.o
-init_cloud_physics.o: modules.o
-init_grid.o: modules.o
-init_masks.o: modules.o
-init_pegrid.o: modules.o
-local_stop.o: modules.o
-message.o: modules.o
-modules.o: modules.f90
-package_parin.o: modules.o
-parin.o: modules.o
-poisfft.o: modules.o fft_xy.o tridia_solver.o
-random_function.o: modules.o
-singleton.o: singleton.f90
-subsidence.o: modules.o
-temperton_fft.o: modules.o
-tridia_solver.o: modules.o
-user_3d_data_averaging.o: modules.o user_module.o
-user_actions.o: modules.o user_module.o
-user_additional_routines.o: modules.o user_module.o
-user_check_data_output.o: modules.o user_module.o
-user_check_data_output_pr.o: modules.o user_module.o
-user_check_parameters.o: modules.o user_module.o
-user_data_output_2d.o: modules.o user_module.o
-user_data_output_3d.o: modules.o user_module.o
-user_data_output_mask.o: modules.o user_module.o
-user_data_output_dvrp.o: modules.o user_module.o
-user_define_netcdf_grid.o: modules.o user_module.o
-user_dvrp_coltab.o: modules.o user_module.o
-user_header.o: modules.o user_module.o
-user_init.o: modules.o user_module.o
-user_init_3d_model.o: modules.o user_module.o
-user_init_grid.o: modules.o user_module.o
-user_init_plant_canopy.o: modules.o user_module.o
-user_last_actions.o: modules.o user_module.o
-user_lpm_advec.o: modules.o user_module.o
-user_lpm_init.o: modules.o user_module.o
-user_lpm_set_attributes.o: modules.o user_module.o
-user_module.o: user_module.f90
-user_parin.o: modules.o user_module.o
-user_read_restart_data.o: modules.o user_module.o
-user_spectra.o: modules.o user_module.o
-user_statistics.o: modules.o user_module.o
+check_open.o: modules.o mod_kinds.o
+check_namelist_files.o: modules.o mod_kinds.o
+check_parameters.o: modules.o mod_kinds.o subsidence.o
+close_file.o: modules.o mod_kinds.o
+cpulog.o: modules.o mod_kinds.o
+cuda_fft_interfaces.o: cuda_fft_interfaces.f90 modules.o mod_kinds.o
+exchange_horiz.o: modules.o cpulog.o mod_kinds.o
+exchange_horiz_2d.o: modules.o cpulog.o mod_kinds.o
+fft_xy.o: cuda_fft_interfaces.o modules.o mod_kinds.o singleton.o temperton_fft.o
+init_cloud_physics.o: modules.o mod_kinds.o
+init_grid.o: modules.o mod_kinds.o
+init_masks.o: modules.o mod_kinds.o
+init_pegrid.o: modules.o mod_kinds.o
+local_flush.o: mod_kinds.o
+local_stop.o: modules.o mod_kinds.o
+message.o: modules.o mod_kinds.o
+modules.o: modules.f90 mod_kinds.o
+mod_kinds.o: mod_kinds.f90
+package_parin.o: modules.o mod_kinds.o
+parin.o: modules.o cpulog.o mod_kinds.o
+poisfft.o: cpulog.o modules.o mod_kinds.o fft_xy.o tridia_solver.o
+singleton.o: mod_kinds.o singleton.f90
+subsidence.o: modules.o mod_kinds.o
+temperton_fft.o: modules.o mod_kinds.o
+tridia_solver.o: modules.o mod_kinds.o
+user_3d_data_averaging.o: modules.o mod_kinds.o user_module.o
+user_actions.o: cpulog.o modules.o mod_kinds.o user_module.o
+user_additional_routines.o: modules.o mod_kinds.o user_module.o
+user_check_data_output.o: modules.o mod_kinds.o user_module.o
+user_check_data_output_pr.o: modules.o mod_kinds.o user_module.o
+user_check_parameters.o: modules.o mod_kinds.o user_module.o
+user_data_output_2d.o: modules.o mod_kinds.o user_module.o
+user_data_output_3d.o: modules.o mod_kinds.o user_module.o
+user_data_output_mask.o: modules.o mod_kinds.o user_module.o
+user_data_output_dvrp.o: modules.o mod_kinds.o user_module.o
+user_define_netcdf_grid.o: modules.o mod_kinds.o user_module.o
+user_dvrp_coltab.o: modules.o mod_kinds.o user_module.o
+user_header.o: modules.o mod_kinds.o user_module.o
+user_init.o: modules.o mod_kinds.o user_module.o
+user_init_3d_model.o: modules.o mod_kinds.o user_module.o
+user_init_grid.o: modules.o mod_kinds.o user_module.o
+user_init_plant_canopy.o: modules.o mod_kinds.o user_module.o
+user_last_actions.o: modules.o mod_kinds.o user_module.o
+user_lpm_advec.o: modules.o mod_kinds.o user_module.o
+user_lpm_init.o: modules.o mod_kinds.o user_module.o
+user_lpm_set_attributes.o: modules.o mod_kinds.o user_module.o
+user_module.o: mod_kinds.o user_module.f90
+user_parin.o: modules.o mod_kinds.o user_module.o
+user_read_restart_data.o: modules.o mod_kinds.o user_module.o
+user_spectra.o: modules.o mod_kinds.o user_module.o
+user_statistics.o: modules.o mod_kinds.o user_module.o
Index: /palm/trunk/SOURCE/advec_s_bc.f90
===================================================================
--- /palm/trunk/SOURCE/advec_s_bc.f90	(revision 1319)
+++ /palm/trunk/SOURCE/advec_s_bc.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -37,26 +42,4 @@
 ! 1010 2012-09-20 07:59:54Z raasch
 ! cpp switch __nopointer added for pointer free version
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 247 2009-02-27 14:01:30Z heinze
-! Output of messages replaced by message handling routine
-!
-! 216 2008-11-25 07:12:43Z raasch
-! Neumann boundary condition at k=nzb is explicitly set for better reading,
-! although this has been already done in boundary_conds
-!
-! 97 2007-06-21 08:23:15Z raasch
-! Advection of salinity included
-! Bugfix: Error in boundary condition for TKE removed
-!
-! 63 2007-03-13 03:52:49Z raasch
-! Calculation extended for gridpoint nzt
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.22  2006/02/23 09:42:08  raasch
-! anz renamed ngp
 !
 ! Revision 1.1  1997/08/29 08:53:46  raasch
@@ -77,39 +60,101 @@
 !------------------------------------------------------------------------------!
 
-    USE advection
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+    USE advection,                                                             &
+        ONLY:  aex, bex, dex, eex
+
+    USE arrays_3d,                                                             &
+        ONLY:  d, ddzw, dzu, dzw, tend, u, v, w
+
+    USE control_parameters,                                                    &
+        ONLY:  dt_3d, bc_pt_t_val, bc_q_t_val, ibc_pt_b, ibc_pt_t, ibc_q_t,    &
+               message_string, pt_slope_offset, sloping_surface, u_gtrans,     &
+               v_gtrans
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx, ddy
+
+    USE indices,                                                               &
+        ONLY:  nx, nxl, nxr, nyn, nys, nzb, nzt
+
+    USE kinds
+
     USE pegrid
-    USE statistics
+
+    USE statistics,                                                            &
+        ONLY:  rmask, statistic_regions, sums_wsts_bc_l
+
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  sk_char
-
-    INTEGER ::  i, ix, j, k, ngp, sr, type_xz_2
-
-    REAL ::  cim, cimf, cip, cipf, d_new, fminus, fplus, f2, f4, f8,        &
-             f12, f24, f48, f1920, im, ip, m2, m3, nenner, snenn, sterm,    &
-             tendenz, t1, t2, zaehler
-    REAL ::  fmax(2), fmax_l(2)
+    CHARACTER (LEN=*) ::  sk_char !:
+
+    INTEGER(iwp) ::  i         !:
+    INTEGER(iwp) ::  ix        !:
+    INTEGER(iwp) ::  j         !:
+    INTEGER(iwp) ::  k         !:
+    INTEGER(iwp) ::  ngp       !:
+    INTEGER(iwp) ::  sr        !:
+    INTEGER(iwp) ::  type_xz_2 !:
+
+    REAL(wp) ::  cim    !:
+    REAL(wp) ::  cimf   !:
+    REAL(wp) ::  cip    !:
+    REAL(wp) ::  cipf   !:
+    REAL(wp) ::  d_new  !:
+    REAL(wp) ::  denomi !: denominator
+    REAL(wp) ::  fminus !:
+    REAL(wp) ::  fplus  !:
+    REAL(wp) ::  f2     !:
+    REAL(wp) ::  f4     !:
+    REAL(wp) ::  f8     !:
+    REAL(wp) ::  f12    !:
+    REAL(wp) ::  f24    !:
+    REAL(wp) ::  f48    !:
+    REAL(wp) ::  f1920  !:
+    REAL(wp) ::  im     !:
+    REAL(wp) ::  ip     !:
+    REAL(wp) ::  m2     !:
+    REAL(wp) ::  m3     !:
+    REAL(wp) ::  numera !: numerator
+    REAL(wp) ::  snenn  !:
+    REAL(wp) ::  sterm  !:
+    REAL(wp) ::  tendcy !:
+    REAL(wp) ::  t1     !:
+    REAL(wp) ::  t2     !:
+
+    REAL(wp) ::  fmax(2)   !:
+    REAL(wp) ::  fmax_l(2) !:
+    
 #if defined( __nopointer )
-    REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk
+    REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk !:
 #else
-    REAL, DIMENSION(:,:,:), POINTER ::  sk
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
 #endif
 
-    REAL, DIMENSION(:,:), ALLOCATABLE ::  a0, a1, a12, a2, a22, immb, imme,  &
-                                          impb, impe, ipmb, ipme, ippb, ippe
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  sk_p
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  a0   !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  a1   !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  a12  !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  a2   !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  a22  !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  immb !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  imme !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  impb !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  impe !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ipmb !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ipme !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ippb !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ippe !:
+    
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  sk_p !:
 
 #if defined( __nec )
-    REAL (kind=4) ::  m1n, m1z  !Wichtig: Division
-    REAL (kind=4), DIMENSION(:,:), ALLOCATABLE :: m1, sw
+    REAL(sp) ::  m1n, m1z  !Wichtig: Division !:
+    REAL(sp), DIMENSION(:,:), ALLOCATABLE :: m1, sw !:
 #else
-    REAL ::  m1n, m1z
-    REAL, DIMENSION(:,:), ALLOCATABLE :: m1, sw
+    REAL(wp) ::  m1n, m1z 
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE :: m1, sw
 #endif
 
@@ -148,11 +193,11 @@
 !
 !-- Send left boundary, receive right boundary
-    CALL MPI_SENDRECV( sk_p(nzb-2,nys-3,nxl+1), ngp, MPI_REAL, pleft,  0, &
-                       sk_p(nzb-2,nys-3,nxr+2), ngp, MPI_REAL, pright, 0, &
+    CALL MPI_SENDRECV( sk_p(nzb-2,nys-3,nxl+1), ngp, MPI_REAL, pleft,  0,      &
+                       sk_p(nzb-2,nys-3,nxr+2), ngp, MPI_REAL, pright, 0,      &
                        comm2d, status, ierr )
 !
 !-- Send right boundary, receive left boundary
-    CALL MPI_SENDRECV( sk_p(nzb-2,nys-3,nxr-2), ngp, MPI_REAL, pright, 1, &
-                       sk_p(nzb-2,nys-3,nxl-3), ngp, MPI_REAL, pleft,  1, &
+    CALL MPI_SENDRECV( sk_p(nzb-2,nys-3,nxr-2), ngp, MPI_REAL, pright, 1,      &
+                       sk_p(nzb-2,nys-3,nxl-3), ngp, MPI_REAL, pleft,  1,      &
                        comm2d, status, ierr )
     CALL cpu_log( log_point_s(11), 'advec_s_bc:sendrecv', 'pause' )
@@ -192,8 +237,8 @@
        DO  j = nys, nyn
           DO  k = nzb+1, nzt
-             zaehler = ABS( sk_p(k,j,i+1) - 2.0 * sk_p(k,j,i) + sk_p(k,j,i-1) )
-             nenner  = ABS( sk_p(k,j,i+1) - sk_p(k,j,i-1) )
-             fmax_l(1) = MAX( fmax_l(1) , zaehler )
-             fmax_l(2) = MAX( fmax_l(2) , nenner  )
+             numera = ABS( sk_p(k,j,i+1) - 2.0 * sk_p(k,j,i) + sk_p(k,j,i-1) )
+             denomi  = ABS( sk_p(k,j,i+1) - sk_p(k,j,i-1) )
+             fmax_l(1) = MAX( fmax_l(1) , numera )
+             fmax_l(2) = MAX( fmax_l(2) , denomi  )
           ENDDO
        ENDDO
@@ -210,12 +255,12 @@
 !
 !-- Allocate temporary arrays
-    ALLOCATE( a0(nzb+1:nzt,nxl-1:nxr+1),   a1(nzb+1:nzt,nxl-1:nxr+1),   &
-              a2(nzb+1:nzt,nxl-1:nxr+1),   a12(nzb+1:nzt,nxl-1:nxr+1),  &
-              a22(nzb+1:nzt,nxl-1:nxr+1),  immb(nzb+1:nzt,nxl-1:nxr+1), &
-              imme(nzb+1:nzt,nxl-1:nxr+1), impb(nzb+1:nzt,nxl-1:nxr+1), &
-              impe(nzb+1:nzt,nxl-1:nxr+1), ipmb(nzb+1:nzt,nxl-1:nxr+1), &
-              ipme(nzb+1:nzt,nxl-1:nxr+1), ippb(nzb+1:nzt,nxl-1:nxr+1), &
-              ippe(nzb+1:nzt,nxl-1:nxr+1), m1(nzb+1:nzt,nxl-2:nxr+2),   &
-              sw(nzb+1:nzt,nxl-1:nxr+1)                                 &
+    ALLOCATE( a0(nzb+1:nzt,nxl-1:nxr+1),   a1(nzb+1:nzt,nxl-1:nxr+1),          &
+              a2(nzb+1:nzt,nxl-1:nxr+1),   a12(nzb+1:nzt,nxl-1:nxr+1),         &
+              a22(nzb+1:nzt,nxl-1:nxr+1),  immb(nzb+1:nzt,nxl-1:nxr+1),        &
+              imme(nzb+1:nzt,nxl-1:nxr+1), impb(nzb+1:nzt,nxl-1:nxr+1),        &
+              impe(nzb+1:nzt,nxl-1:nxr+1), ipmb(nzb+1:nzt,nxl-1:nxr+1),        &
+              ipme(nzb+1:nzt,nxl-1:nxr+1), ippb(nzb+1:nzt,nxl-1:nxr+1),        &
+              ippe(nzb+1:nzt,nxl-1:nxr+1), m1(nzb+1:nzt,nxl-2:nxr+2),          &
+              sw(nzb+1:nzt,nxl-1:nxr+1)                                        &
             )
     imme = 0.0; impe = 0.0; ipme = 0.0; ippe = 0.0
@@ -236,14 +281,14 @@
           DO  k = nzb+1, nzt
              a12(k,i) = 0.5 * ( sk_p(k,j,i+1) - sk_p(k,j,i-1) )
-             a22(k,i) = 0.5 * ( sk_p(k,j,i+1) - 2.0 * sk_p(k,j,i) &
+             a22(k,i) = 0.5 * ( sk_p(k,j,i+1) - 2.0 * sk_p(k,j,i)              &
                                               + sk_p(k,j,i-1) )
-             a0(k,i) = ( 9.0 * sk_p(k,j,i+2) - 116.0 * sk_p(k,j,i+1)    &
-                         + 2134.0 * sk_p(k,j,i) - 116.0 * sk_p(k,j,i-1) &
+             a0(k,i) = ( 9.0 * sk_p(k,j,i+2) - 116.0 * sk_p(k,j,i+1)           &
+                         + 2134.0 * sk_p(k,j,i) - 116.0 * sk_p(k,j,i-1)        &
                          + 9.0 * sk_p(k,j,i-2) ) * f1920
-             a1(k,i) = ( -5.0 * sk_p(k,j,i+2) + 34.0 * sk_p(k,j,i+1)  &
-                         - 34.0 * sk_p(k,j,i-1) + 5.0 * sk_p(k,j,i-2) &
+             a1(k,i) = ( -5.0 * sk_p(k,j,i+2) + 34.0 * sk_p(k,j,i+1)           &
+                         - 34.0 * sk_p(k,j,i-1) + 5.0 * sk_p(k,j,i-2)          &
                        ) * f48
-             a2(k,i) = ( -3.0 * sk_p(k,j,i+2) + 36.0 * sk_p(k,j,i+1) &
-                         - 66.0 * sk_p(k,j,i) + 36.0 * sk_p(k,j,i-1) &
+             a2(k,i) = ( -3.0 * sk_p(k,j,i+2) + 36.0 * sk_p(k,j,i+1)           &
+                         - 66.0 * sk_p(k,j,i) + 36.0 * sk_p(k,j,i-1)           &
                          - 3.0 * sk_p(k,j,i-2) ) * f48
           ENDDO
@@ -259,9 +304,9 @@
              cipf = 1.0 - 2.0 * cip
              cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k,i)   * f2  * ( 1.0 - cipf )             &
-                    + a1(k,i)   * f8  * ( 1.0 - cipf*cipf )        &
+             ip   =   a0(k,i)   * f2  * ( 1.0 - cipf )                         &
+                    + a1(k,i)   * f8  * ( 1.0 - cipf*cipf )                    &
                     + a2(k,i)   * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k,i+1) * f2  * ( 1.0 - cimf )             &
-                    - a1(k,i+1) * f8  * ( 1.0 - cimf*cimf )        &
+             im   =   a0(k,i+1) * f2  * ( 1.0 - cimf )                         &
+                    - a1(k,i+1) * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k,i+1) * f24 * ( 1.0 - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0 )
@@ -274,9 +319,9 @@
              cipf = 1.0 - 2.0 * cip
              cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k,i-1) * f2  * ( 1.0 - cipf )             &
-                    + a1(k,i-1) * f8  * ( 1.0 - cipf*cipf )        &
+             ip   =   a0(k,i-1) * f2  * ( 1.0 - cipf )                         &
+                    + a1(k,i-1) * f8  * ( 1.0 - cipf*cipf )                    &
                     + a2(k,i-1) * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k,i)   * f2  * ( 1.0 - cimf )             &
-                    - a1(k,i)   * f8  * ( 1.0 - cimf*cimf )        &
+             im   =   a0(k,i)   * f2  * ( 1.0 - cimf )                         &
+                    - a1(k,i)   * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k,i)   * f24 * ( 1.0 - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0 )
@@ -309,9 +354,9 @@
        DO  i = nxl-1, nxr+1
           DO  k = nzb+1, nzt
-             m2 = 2.0 * ABS( a1(k,i) - a12(k,i) ) / &
+             m2 = 2.0 * ABS( a1(k,i) - a12(k,i) ) /                            &
                   MAX( ABS( a1(k,i) + a12(k,i) ), 1E-35 )
              IF ( ABS( a1(k,i) + a12(k,i) ) < fmax(2) )  m2 = 0.0
 
-             m3 = 2.0 * ABS( a2(k,i) - a22(k,i) ) / &
+             m3 = 2.0 * ABS( a2(k,i) - a22(k,i) ) /                            &
                   MAX( ABS( a2(k,i) + a22(k,i) ), 1E-35 )
              IF ( ABS( a2(k,i) + a22(k,i) ) < fmax(1) )  m3 = 0.0
@@ -322,8 +367,8 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( m1(k,i-1) == 1.0 .OR. m1(k,i) == 1.0 .OR. m1(k,i+1) == 1.0 &
-                  .OR.  m2 > t2  .OR.  m3 > T2  .OR.                         &
-                  ( m1(k,i) > t1  .AND.  m1(k,i-1) /= -1.0  .AND.            &
-                    m1(k,i) /= -1.0  .AND.  m1(k,i+1) /= -1.0 )              &
+             IF ( m1(k,i-1) == 1.0 .OR. m1(k,i) == 1.0 .OR. m1(k,i+1) == 1.0   &
+                  .OR.  m2 > t2  .OR.  m3 > t2  .OR.                           &
+                  ( m1(k,i) > t1  .AND.  m1(k,i-1) /= -1.0  .AND.              &
+                    m1(k,i) /= -1.0  .AND.  m1(k,i+1) /= -1.0 )                &
                 )  sw(k,i) = 1.0
           ENDDO
@@ -425,17 +470,17 @@
        DO  i = nxl, nxr
           DO  k = nzb+1, nzt
-             fplus  = ( 1.0 - sw(k,i)   ) * ippb(k,i) + sw(k,i)   * ippe(k,i) &
+             fplus  = ( 1.0 - sw(k,i)   ) * ippb(k,i) + sw(k,i)   * ippe(k,i)  &
                     - ( 1.0 - sw(k,i+1) ) * impb(k,i) - sw(k,i+1) * impe(k,i)
-             fminus = ( 1.0 - sw(k,i-1) ) * ipmb(k,i) + sw(k,i-1) * ipme(k,i) &
+             fminus = ( 1.0 - sw(k,i-1) ) * ipmb(k,i) + sw(k,i-1) * ipme(k,i)  &
                     - ( 1.0 - sw(k,i)   ) * immb(k,i) - sw(k,i)   * imme(k,i)
-             tendenz = fplus - fminus
+             tendcy = fplus - fminus
 !
 !--           Removed in order to optimize speed
 !             ffmax   = MAX( ABS( fplus ), ABS( fminus ), 1E-35 )
-!             IF ( ( ABS( tendenz ) / ffmax ) < 1E-7 )  tendenz = 0.0
+!             IF ( ( ABS( tendcy ) / ffmax ) < 1E-7 )  tendcy = 0.0
 !
 !--          Density correction because of possible remaining divergences
              d_new = d(k,j,i) - ( u(k,j,i+1) - u(k,j,i) ) * dt_3d * ddx
-             sk_p(k,j,i) = ( ( 1.0 + d(k,j,i) ) * sk_p(k,j,i) - tendenz ) / &
+             sk_p(k,j,i) = ( ( 1.0 + d(k,j,i) ) * sk_p(k,j,i) - tendcy ) /    &
                            ( 1.0 + d_new )
              d(k,j,i)  = d_new
@@ -447,5 +492,5 @@
 !
 !-- Deallocate temporary arrays
-    DEALLOCATE( a0, a1, a2, a12, a22, immb, imme, impb, impe, ipmb, ipme, &
+    DEALLOCATE( a0, a1, a2, a12, a22, immb, imme, impb, impe, ipmb, ipme,      &
                 ippb, ippe, m1, sw )
 
@@ -455,5 +500,5 @@
 #if defined( __parallel )
     ngp = ( nzt - nzb + 6 ) * ( nyn - nys + 7 )
-    CALL MPI_TYPE_VECTOR( nxr-nxl+7, 3*(nzt-nzb+6), ngp, MPI_REAL, &
+    CALL MPI_TYPE_VECTOR( nxr-nxl+7, 3*(nzt-nzb+6), ngp, MPI_REAL,             &
                           type_xz_2, ierr )
     CALL MPI_TYPE_COMMIT( type_xz_2, ierr )
@@ -461,11 +506,11 @@
 !-- Send front boundary, receive rear boundary
     CALL cpu_log( log_point_s(11), 'advec_s_bc:sendrecv', 'continue' )
-    CALL MPI_SENDRECV( sk_p(nzb-2,nys,nxl-3),   1, type_xz_2, psouth, 0, &
-                       sk_p(nzb-2,nyn+1,nxl-3), 1, type_xz_2, pnorth, 0, &
+    CALL MPI_SENDRECV( sk_p(nzb-2,nys,nxl-3),   1, type_xz_2, psouth, 0,       &
+                       sk_p(nzb-2,nyn+1,nxl-3), 1, type_xz_2, pnorth, 0,       &
                        comm2d, status, ierr )
 !
 !-- Send rear boundary, receive front boundary
-    CALL MPI_SENDRECV( sk_p(nzb-2,nyn-2,nxl-3), 1, type_xz_2, pnorth, 1, &
-                       sk_p(nzb-2,nys-3,nxl-3), 1, type_xz_2, psouth, 1, &
+    CALL MPI_SENDRECV( sk_p(nzb-2,nyn-2,nxl-3), 1, type_xz_2, pnorth, 1,       &
+                       sk_p(nzb-2,nys-3,nxl-3), 1, type_xz_2, psouth, 1,       &
                        comm2d, status, ierr )
     CALL MPI_TYPE_FREE( type_xz_2, ierr )
@@ -490,8 +535,8 @@
        DO  j = nys, nyn
           DO  k = nzb+1, nzt
-             zaehler = ABS( sk_p(k,j+1,i) - 2.0 * sk_p(k,j,i) + sk_p(k,j-1,i) )
-             nenner  = ABS( sk_p(k,j+1,i) - sk_p(k,j-1,i) )
-             fmax_l(1) = MAX( fmax_l(1) , zaehler )
-             fmax_l(2) = MAX( fmax_l(2) , nenner  )
+             numera = ABS( sk_p(k,j+1,i) - 2.0 * sk_p(k,j,i) + sk_p(k,j-1,i) )
+             denomi  = ABS( sk_p(k,j+1,i) - sk_p(k,j-1,i) )
+             fmax_l(1) = MAX( fmax_l(1) , numera )
+             fmax_l(2) = MAX( fmax_l(2) , denomi  )
           ENDDO
        ENDDO
@@ -508,12 +553,12 @@
 !
 !-- Allocate temporary arrays
-    ALLOCATE( a0(nzb+1:nzt,nys-1:nyn+1),   a1(nzb+1:nzt,nys-1:nyn+1),   &
-              a2(nzb+1:nzt,nys-1:nyn+1),   a12(nzb+1:nzt,nys-1:nyn+1),  &
-              a22(nzb+1:nzt,nys-1:nyn+1),  immb(nzb+1:nzt,nys-1:nyn+1), &
-              imme(nzb+1:nzt,nys-1:nyn+1), impb(nzb+1:nzt,nys-1:nyn+1), &
-              impe(nzb+1:nzt,nys-1:nyn+1), ipmb(nzb+1:nzt,nys-1:nyn+1), &
-              ipme(nzb+1:nzt,nys-1:nyn+1), ippb(nzb+1:nzt,nys-1:nyn+1), &
-              ippe(nzb+1:nzt,nys-1:nyn+1), m1(nzb+1:nzt,nys-2:nyn+2),   &
-              sw(nzb+1:nzt,nys-1:nyn+1)                                 &
+    ALLOCATE( a0(nzb+1:nzt,nys-1:nyn+1),   a1(nzb+1:nzt,nys-1:nyn+1),          &
+              a2(nzb+1:nzt,nys-1:nyn+1),   a12(nzb+1:nzt,nys-1:nyn+1),         &
+              a22(nzb+1:nzt,nys-1:nyn+1),  immb(nzb+1:nzt,nys-1:nyn+1),        &
+              imme(nzb+1:nzt,nys-1:nyn+1), impb(nzb+1:nzt,nys-1:nyn+1),        &
+              impe(nzb+1:nzt,nys-1:nyn+1), ipmb(nzb+1:nzt,nys-1:nyn+1),        &
+              ipme(nzb+1:nzt,nys-1:nyn+1), ippb(nzb+1:nzt,nys-1:nyn+1),        &
+              ippe(nzb+1:nzt,nys-1:nyn+1), m1(nzb+1:nzt,nys-2:nyn+2),          &
+              sw(nzb+1:nzt,nys-1:nyn+1)                                        &
             )
     imme = 0.0; impe = 0.0; ipme = 0.0; ippe = 0.0
@@ -528,14 +573,14 @@
           DO  k = nzb+1, nzt
              a12(k,j) = 0.5 * ( sk_p(k,j+1,i) - sk_p(k,j-1,i) )
-             a22(k,j) = 0.5 * ( sk_p(k,j+1,i) - 2.0 * sk_p(k,j,i) &
+             a22(k,j) = 0.5 * ( sk_p(k,j+1,i) - 2.0 * sk_p(k,j,i)              &
                                               + sk_p(k,j-1,i) )
-             a0(k,j) = ( 9.0 * sk_p(k,j+2,i) - 116.0 * sk_p(k,j+1,i)    &
-                         + 2134.0 * sk_p(k,j,i) - 116.0 * sk_p(k,j-1,i) &
+             a0(k,j) = ( 9.0 * sk_p(k,j+2,i) - 116.0 * sk_p(k,j+1,i)           &
+                         + 2134.0 * sk_p(k,j,i) - 116.0 * sk_p(k,j-1,i)        &
                          + 9.0 * sk_p(k,j-2,i) ) * f1920
-             a1(k,j) = ( -5.0 * sk_p(k,j+2,i) + 34.0 * sk_p(k,j+1,i)  &
-                         - 34.0 * sk_p(k,j-1,i) + 5.0 * sk_p(k,j-2,i) &
+             a1(k,j) = ( -5.0 * sk_p(k,j+2,i) + 34.0 * sk_p(k,j+1,i)           &
+                         - 34.0 * sk_p(k,j-1,i) + 5.0 * sk_p(k,j-2,i)          &
                        ) * f48
-             a2(k,j) = ( -3.0 * sk_p(k,j+2,i) + 36.0 * sk_p(k,j+1,i) &
-                         - 66.0 * sk_p(k,j,i) + 36.0 * sk_p(k,j-1,i) &
+             a2(k,j) = ( -3.0 * sk_p(k,j+2,i) + 36.0 * sk_p(k,j+1,i)           &
+                         - 66.0 * sk_p(k,j,i) + 36.0 * sk_p(k,j-1,i)           &
                          - 3.0 * sk_p(k,j-2,i) ) * f48
           ENDDO
@@ -551,9 +596,9 @@
              cipf = 1.0 - 2.0 * cip
              cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k,j)   * f2  * ( 1.0 - cipf )             &
-                    + a1(k,j)   * f8  * ( 1.0 - cipf*cipf )        &
+             ip   =   a0(k,j)   * f2  * ( 1.0 - cipf )                         &
+                    + a1(k,j)   * f8  * ( 1.0 - cipf*cipf )                    &
                     + a2(k,j)   * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k,j+1) * f2  * ( 1.0 - cimf )             &
-                    - a1(k,j+1) * f8  * ( 1.0 - cimf*cimf )        &
+             im   =   a0(k,j+1) * f2  * ( 1.0 - cimf )                         &
+                    - a1(k,j+1) * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k,j+1) * f24 * ( 1.0 - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0 )
@@ -566,9 +611,9 @@
              cipf = 1.0 - 2.0 * cip
              cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k,j-1) * f2  * ( 1.0 - cipf )             &
-                    + a1(k,j-1) * f8  * ( 1.0 - cipf*cipf )        &
+             ip   =   a0(k,j-1) * f2  * ( 1.0 - cipf )                         &
+                    + a1(k,j-1) * f8  * ( 1.0 - cipf*cipf )                    &
                     + a2(k,j-1) * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k,j)   * f2  * ( 1.0 - cimf )             &
-                    - a1(k,j)   * f8  * ( 1.0 - cimf*cimf )        &
+             im   =   a0(k,j)   * f2  * ( 1.0 - cimf )                         &
+                    - a1(k,j)   * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k,j)   * f24 * ( 1.0 - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0 )
@@ -601,9 +646,9 @@
        DO  j = nys-1, nyn+1
           DO  k = nzb+1, nzt
-             m2 = 2.0 * ABS( a1(k,j) - a12(k,j) ) / &
+             m2 = 2.0 * ABS( a1(k,j) - a12(k,j) ) /                            &
                   MAX( ABS( a1(k,j) + a12(k,j) ), 1E-35 )
              IF ( ABS( a1(k,j) + a12(k,j) ) < fmax(2) )  m2 = 0.0
 
-             m3 = 2.0 * ABS( a2(k,j) - a22(k,j) ) / &
+             m3 = 2.0 * ABS( a2(k,j) - a22(k,j) ) /                            &
                   MAX( ABS( a2(k,j) + a22(k,j) ), 1E-35 )
              IF ( ABS( a2(k,j) + a22(k,j) ) < fmax(1) )  m3 = 0.0
@@ -614,8 +659,8 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( m1(k,j-1) == 1.0 .OR. m1(k,j) == 1.0 .OR. m1(k,j+1) == 1.0 &
-                  .OR.  m2 > t2  .OR.  m3 > T2  .OR.                         &
-                  ( m1(k,j) > t1  .AND.  m1(k,j-1) /= -1.0  .AND.            &
-                    m1(k,j) /= -1.0  .AND.  m1(k,j+1) /= -1.0 )              &
+             IF ( m1(k,j-1) == 1.0 .OR. m1(k,j) == 1.0 .OR. m1(k,j+1) == 1.0   &
+                  .OR.  m2 > t2  .OR.  m3 > t2  .OR.                           &
+                  ( m1(k,j) > t1  .AND.  m1(k,j-1) /= -1.0  .AND.              &
+                    m1(k,j) /= -1.0  .AND.  m1(k,j+1) /= -1.0 )                &
                 )  sw(k,j) = 1.0
           ENDDO
@@ -717,17 +762,17 @@
        DO  j = nys, nyn
           DO  k = nzb+1, nzt
-             fplus  = ( 1.0 - sw(k,j)   ) * ippb(k,j) + sw(k,j)   * ippe(k,j) &
+             fplus  = ( 1.0 - sw(k,j)   ) * ippb(k,j) + sw(k,j)   * ippe(k,j)  &
                     - ( 1.0 - sw(k,j+1) ) * impb(k,j) - sw(k,j+1) * impe(k,j)
-             fminus = ( 1.0 - sw(k,j-1) ) * ipmb(k,j) + sw(k,j-1) * ipme(k,j) &
+             fminus = ( 1.0 - sw(k,j-1) ) * ipmb(k,j) + sw(k,j-1) * ipme(k,j)  &
                     - ( 1.0 - sw(k,j)   ) * immb(k,j) - sw(k,j)   * imme(k,j)
-             tendenz = fplus - fminus
+             tendcy = fplus - fminus
 !
 !--           Removed in order to optimise speed
 !             ffmax   = MAX( ABS( fplus ), ABS( fminus ), 1E-35 )
-!             IF ( ( ABS( tendenz ) / ffmax ) < 1E-7 )  tendenz = 0.0
+!             IF ( ( ABS( tendcy ) / ffmax ) < 1E-7 )  tendcy = 0.0
 !
 !--          Density correction because of possible remaining divergences
              d_new = d(k,j,i) - ( v(k,j+1,i) - v(k,j,i) ) * dt_3d * ddy
-             sk_p(k,j,i) = ( ( 1.0 + d(k,j,i) ) * sk_p(k,j,i) - tendenz ) / &
+             sk_p(k,j,i) = ( ( 1.0 + d(k,j,i) ) * sk_p(k,j,i) - tendcy ) /    &
                            ( 1.0 + d_new )
              d(k,j,i)  = d_new
@@ -741,5 +786,5 @@
 !
 !-- Deallocate temporary arrays
-    DEALLOCATE( a0, a1, a2, a12, a22, immb, imme, impb, impe, ipmb, ipme, &
+    DEALLOCATE( a0, a1, a2, a12, a22, immb, imme, impb, impe, ipmb, ipme,      &
                 ippb, ippe, m1, sw )
 
@@ -879,5 +924,5 @@
     ELSE
 
-       WRITE( message_string, * ) 'no vertical boundary condi', &
+       WRITE( message_string, * ) 'no vertical boundary condi',                &
                                 'tion for variable "', sk_char, '"'
        CALL message( 'advec_s_bc', 'PA0158', 1, 2, 0, 6, 0 )
@@ -891,8 +936,8 @@
        DO  j = nys, nyn
           DO  k = nzb, nzt+1
-             zaehler = ABS( sk_p(k+1,j,i) - 2.0 * sk_p(k,j,i) + sk_p(k-1,j,i) )
-             nenner  = ABS( sk_p(k+1,j,i+1) - sk_p(k-1,j,i) )
-             fmax_l(1) = MAX( fmax_l(1) , zaehler )
-             fmax_l(2) = MAX( fmax_l(2) , nenner  )
+             numera = ABS( sk_p(k+1,j,i) - 2.0 * sk_p(k,j,i) + sk_p(k-1,j,i) )
+             denomi  = ABS( sk_p(k+1,j,i+1) - sk_p(k-1,j,i) )
+             fmax_l(1) = MAX( fmax_l(1) , numera )
+             fmax_l(2) = MAX( fmax_l(2) , denomi  )
           ENDDO
        ENDDO
@@ -909,12 +954,12 @@
 !
 !-- Allocate temporary arrays
-    ALLOCATE( a0(nzb:nzt+1,nys:nyn),   a1(nzb:nzt+1,nys:nyn),   &
-              a2(nzb:nzt+1,nys:nyn),   a12(nzb:nzt+1,nys:nyn),  &
-              a22(nzb:nzt+1,nys:nyn),  immb(nzb+1:nzt,nys:nyn), &
-              imme(nzb+1:nzt,nys:nyn), impb(nzb+1:nzt,nys:nyn), &
-              impe(nzb+1:nzt,nys:nyn), ipmb(nzb+1:nzt,nys:nyn), &
-              ipme(nzb+1:nzt,nys:nyn), ippb(nzb+1:nzt,nys:nyn), &
-              ippe(nzb+1:nzt,nys:nyn), m1(nzb-1:nzt+2,nys:nyn), &
-              sw(nzb:nzt+1,nys:nyn)                             &
+    ALLOCATE( a0(nzb:nzt+1,nys:nyn),   a1(nzb:nzt+1,nys:nyn),                  &
+              a2(nzb:nzt+1,nys:nyn),   a12(nzb:nzt+1,nys:nyn),                 &
+              a22(nzb:nzt+1,nys:nyn),  immb(nzb+1:nzt,nys:nyn),                &
+              imme(nzb+1:nzt,nys:nyn), impb(nzb+1:nzt,nys:nyn),                &
+              impe(nzb+1:nzt,nys:nyn), ipmb(nzb+1:nzt,nys:nyn),                &
+              ipme(nzb+1:nzt,nys:nyn), ippb(nzb+1:nzt,nys:nyn),                &
+              ippe(nzb+1:nzt,nys:nyn), m1(nzb-1:nzt+2,nys:nyn),                &
+              sw(nzb:nzt+1,nys:nyn)                                            &
             )
     imme = 0.0; impe = 0.0; ipme = 0.0; ippe = 0.0
@@ -929,14 +974,14 @@
           DO  k = nzb, nzt+1
              a12(k,j) = 0.5 * ( sk_p(k+1,j,i) - sk_p(k-1,j,i) )
-             a22(k,j) = 0.5 * ( sk_p(k+1,j,i) - 2.0 * sk_p(k,j,i) &
+             a22(k,j) = 0.5 * ( sk_p(k+1,j,i) - 2.0 * sk_p(k,j,i)              &
                                               + sk_p(k-1,j,i) )
-             a0(k,j) = ( 9.0 * sk_p(k+2,j,i) - 116.0 * sk_p(k+1,j,i)    &
-                         + 2134.0 * sk_p(k,j,i) - 116.0 * sk_p(k-1,j,i) &
+             a0(k,j) = ( 9.0 * sk_p(k+2,j,i) - 116.0 * sk_p(k+1,j,i)           &
+                         + 2134.0 * sk_p(k,j,i) - 116.0 * sk_p(k-1,j,i)        &
                          + 9.0 * sk_p(k-2,j,i) ) * f1920
-             a1(k,j) = ( -5.0 * sk_p(k+2,j,i) + 34.0 * sk_p(k+1,j,i)  &
-                         - 34.0 * sk_p(k-1,j,i) + 5.0 * sk_p(k-2,j,i) &
+             a1(k,j) = ( -5.0 * sk_p(k+2,j,i) + 34.0 * sk_p(k+1,j,i)           &
+                         - 34.0 * sk_p(k-1,j,i) + 5.0 * sk_p(k-2,j,i)          &
                        ) * f48
-             a2(k,j) = ( -3.0 * sk_p(k+2,j,i) + 36.0 * sk_p(k+1,j,i) &
-                         - 66.0 * sk_p(k,j,i) + 36.0 * sk_p(k-1,j,i) &
+             a2(k,j) = ( -3.0 * sk_p(k+2,j,i) + 36.0 * sk_p(k+1,j,i)           &
+                         - 66.0 * sk_p(k,j,i) + 36.0 * sk_p(k-1,j,i)           &
                          - 3.0 * sk_p(k-2,j,i) ) * f48
           ENDDO
@@ -952,9 +997,9 @@
              cipf = 1.0 - 2.0 * cip
              cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k,j)   * f2  * ( 1.0 - cipf )             &
-                    + a1(k,j)   * f8  * ( 1.0 - cipf*cipf )        &
+             ip   =   a0(k,j)   * f2  * ( 1.0 - cipf )                         &
+                    + a1(k,j)   * f8  * ( 1.0 - cipf*cipf )                    &
                     + a2(k,j)   * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k+1,j) * f2  * ( 1.0 - cimf )             &
-                    - a1(k+1,j) * f8  * ( 1.0 - cimf*cimf )        &
+             im   =   a0(k+1,j) * f2  * ( 1.0 - cimf )                         &
+                    - a1(k+1,j) * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k+1,j) * f24 * ( 1.0 - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0 )
@@ -967,9 +1012,9 @@
              cipf = 1.0 - 2.0 * cip
              cimf = 1.0 - 2.0 * cim
-             ip   =   a0(k-1,j) * f2  * ( 1.0 - cipf )             &
-                    + a1(k-1,j) * f8  * ( 1.0 - cipf*cipf )        &
+             ip   =   a0(k-1,j) * f2  * ( 1.0 - cipf )                         &
+                    + a1(k-1,j) * f8  * ( 1.0 - cipf*cipf )                    &
                     + a2(k-1,j) * f24 * ( 1.0 - cipf*cipf*cipf )
-             im   =   a0(k,j)   * f2  * ( 1.0 - cimf )             &
-                    - a1(k,j)   * f8  * ( 1.0 - cimf*cimf )        &
+             im   =   a0(k,j)   * f2  * ( 1.0 - cimf )                         &
+                    - a1(k,j)   * f8  * ( 1.0 - cimf*cimf )                    &
                     + a2(k,j)   * f24 * ( 1.0 - cimf*cimf*cimf )
              ip   = MAX( ip, 0.0 )
@@ -1002,9 +1047,9 @@
        DO  j = nys, nyn
           DO  k = nzb, nzt+1
-             m2 = 2.0 * ABS( a1(k,j) - a12(k,j) ) / &
+             m2 = 2.0 * ABS( a1(k,j) - a12(k,j) ) /                            &
                   MAX( ABS( a1(k,j) + a12(k,j) ), 1E-35 )
              IF ( ABS( a1(k,j) + a12(k,j) ) < fmax(2) )  m2 = 0.0
 
-             m3 = 2.0 * ABS( a2(k,j) - a22(k,j) ) / &
+             m3 = 2.0 * ABS( a2(k,j) - a22(k,j) ) /                            &
                   MAX( ABS( a2(k,j) + a22(k,j) ), 1E-35 )
              IF ( ABS( a2(k,j) + a22(k,j) ) < fmax(1) )  m3 = 0.0
@@ -1015,8 +1060,8 @@
 
 !--          *VOCL STMT,IF(10)
-             IF ( m1(k-1,j) == 1.0 .OR. m1(k,j) == 1.0 .OR. m1(k+1,j) == 1.0 &
-                  .OR.  m2 > t2  .OR.  m3 > T2  .OR.                         &
-                  ( m1(k,j) > t1  .AND.  m1(k-1,j) /= -1.0  .AND.            &
-                    m1(k,j) /= -1.0  .AND.  m1(k+1,j) /= -1.0 )              &
+             IF ( m1(k-1,j) == 1.0 .OR. m1(k,j) == 1.0 .OR. m1(k+1,j) == 1.0   &
+                  .OR.  m2 > t2  .OR.  m3 > t2  .OR.                           &
+                  ( m1(k,j) > t1  .AND.  m1(k-1,j) /= -1.0  .AND.              &
+                    m1(k,j) /= -1.0  .AND.  m1(k+1,j) /= -1.0 )                &
                 )  sw(k,j) = 1.0
           ENDDO
@@ -1118,17 +1163,17 @@
        DO  j = nys, nyn
           DO  k = nzb+1, nzt
-             fplus  = ( 1.0 - sw(k,j)   ) * ippb(k,j) + sw(k,j)   * ippe(k,j) &
+             fplus  = ( 1.0 - sw(k,j)   ) * ippb(k,j) + sw(k,j)   * ippe(k,j)  &
                     - ( 1.0 - sw(k+1,j) ) * impb(k,j) - sw(k+1,j) * impe(k,j)
-             fminus = ( 1.0 - sw(k-1,j) ) * ipmb(k,j) + sw(k-1,j) * ipme(k,j) &
+             fminus = ( 1.0 - sw(k-1,j) ) * ipmb(k,j) + sw(k-1,j) * ipme(k,j)  &
                     - ( 1.0 - sw(k,j)   ) * immb(k,j) - sw(k,j)   * imme(k,j)
-             tendenz = fplus - fminus
+             tendcy = fplus - fminus
 !
 !--           Removed in order to optimise speed
 !             ffmax   = MAX( ABS( fplus ), ABS( fminus ), 1E-35 )
-!             IF ( ( ABS( tendenz ) / ffmax ) < 1E-7 )  tendenz = 0.0
+!             IF ( ( ABS( tendcy ) / ffmax ) < 1E-7 )  tendcy = 0.0
 !
 !--          Density correction because of possible remaining divergences
              d_new = d(k,j,i) - ( w(k,j,i) - w(k-1,j,i) ) * dt_3d * ddzw(k)
-             sk_p(k,j,i) = ( ( 1.0 + d(k,j,i) ) * sk_p(k,j,i) - tendenz ) / &
+             sk_p(k,j,i) = ( ( 1.0 + d(k,j,i) ) * sk_p(k,j,i) - tendcy ) /    &
                            ( 1.0 + d_new )
 !
@@ -1145,5 +1190,5 @@
              DO  j = nys, nyn
                 DO  k = nzb+1, nzt
-                   sums_wsts_bc_l(k,sr) = sums_wsts_bc_l(k,sr) + &
+                   sums_wsts_bc_l(k,sr) = sums_wsts_bc_l(k,sr) +               &
                                           m1(k,j) * rmask(j,i,sr)
                 ENDDO
@@ -1158,5 +1203,5 @@
 !
 !-- Deallocate temporary arrays
-    DEALLOCATE( a0, a1, a2, a12, a22, immb, imme, impb, impe, ipmb, ipme, &
+    DEALLOCATE( a0, a1, a2, a12, a22, immb, imme, impb, impe, ipmb, ipme,      &
                 ippb, ippe, m1, sw )
 
Index: /palm/trunk/SOURCE/advec_s_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_s_pw.f90	(revision 1319)
+++ /palm/trunk/SOURCE/advec_s_pw.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -31,12 +36,4 @@
 ! 1010 2012-09-20 07:59:54Z raasch
 ! cpp switch __nopointer added for pointer free version
-!
-! 19 2007-02-23 04:53:48Z raasch
-! Calculation extended for gridpoint nzt
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.12  2006/02/23 09:42:55  raasch
-! nzb_2d replaced by nzb_s_inner
 !
 ! Revision 1.1  1997/08/29 08:54:20  raasch
@@ -70,17 +67,29 @@
     SUBROUTINE advec_s_pw( sk )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  dd2zu, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb_s_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
 
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  sk
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
 #endif
  
@@ -111,17 +120,29 @@
     SUBROUTINE advec_s_pw_ij( i, j, sk )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  dd2zu, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nzb_s_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
 
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  sk
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
 #endif
 
Index: /palm/trunk/SOURCE/advec_s_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_s_up.f90	(revision 1319)
+++ /palm/trunk/SOURCE/advec_s_up.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -34,9 +39,4 @@
 ! 981 2012-08-09 14:57:44Z maronga
 ! Typo removed
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.11  2006/02/23 09:43:44  raasch
-! nzb_2d replaced by nzb_s_inner
 !
 ! Revision 1.1  1997/08/29 08:54:33  raasch
@@ -67,18 +67,32 @@
     SUBROUTINE advec_s_up( sk )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb_s_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL ::  ukomp, vkomp, wkomp
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+
+       REAL(wp) ::  ukomp !:
+       REAL(wp) ::  vkomp !:
+       REAL(wp) ::  wkomp !:
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  sk
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
 #endif
 
@@ -91,8 +105,8 @@
                 ukomp = 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans
                 IF ( ukomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - ukomp * &
+                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( sk(k,j,i) - sk(k,j,i-1) ) * ddx
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - ukomp * &
+                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( sk(k,j,i+1) - sk(k,j,i) ) * ddx
                 ENDIF
@@ -101,8 +115,8 @@
                 vkomp = 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans
                 IF ( vkomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - vkomp * &
+                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( sk(k,j,i) - sk(k,j-1,i) ) * ddy
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - vkomp * &
+                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( sk(k,j+1,i) - sk(k,j,i) ) * ddy
                 ENDIF
@@ -111,8 +125,8 @@
                 wkomp = 0.5 * ( w(k,j,i) + w(k-1,j,i) )
                 IF ( wkomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - wkomp * &
+                   tend(k,j,i) = tend(k,j,i) - wkomp *                         &
                                          ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k)
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - wkomp * &
+                   tend(k,j,i) = tend(k,j,i) - wkomp *                         &
                                          ( sk(k+1,j,i)-sk(k,j,i) ) * ddzu(k+1)
                 ENDIF
@@ -130,18 +144,33 @@
     SUBROUTINE advec_s_up_ij( i, j, sk )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nzb_s_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL ::  ukomp, vkomp, wkomp
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+
+       REAL(wp) ::  ukomp !:
+       REAL(wp) ::  vkomp !:
+       REAL(wp) ::  wkomp !:
+       
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  sk
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
 #endif
 
@@ -152,8 +181,8 @@
           ukomp = 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans
           IF ( ukomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - ukomp * &
+             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( sk(k,j,i) - sk(k,j,i-1) ) * ddx
           ELSE
-             tend(k,j,i) = tend(k,j,i) - ukomp * &
+             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( sk(k,j,i+1) - sk(k,j,i) ) * ddx
           ENDIF
@@ -162,8 +191,8 @@
           vkomp = 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans
           IF ( vkomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - vkomp * &
+             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( sk(k,j,i) - sk(k,j-1,i) ) * ddy
           ELSE
-             tend(k,j,i) = tend(k,j,i) - vkomp * &
+             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( sk(k,j+1,i) - sk(k,j,i) ) * ddy
           ENDIF
@@ -172,8 +201,8 @@
           wkomp = 0.5 * ( w(k,j,i) + w(k-1,j,i) )
           IF ( wkomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - wkomp * &
+             tend(k,j,i) = tend(k,j,i) - wkomp *                               &
                                          ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k)
           ELSE
-             tend(k,j,i) = tend(k,j,i) - wkomp * &
+             tend(k,j,i) = tend(k,j,i) - wkomp *                               &
                                          ( sk(k+1,j,i)-sk(k,j,i) ) * ddzu(k+1)
           ENDIF
Index: /palm/trunk/SOURCE/advec_u_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_u_pw.f90	(revision 1319)
+++ /palm/trunk/SOURCE/advec_u_pw.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,15 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 106 2007-08-16 14:30:26Z raasch
-! i loop is starting from nxlu (needed for non-cyclic boundary conditions)
-!
-! 75 2007-03-22 09:54:05Z raasch
-! uxrp eliminated
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.15  2006/02/23 09:44:21  raasch
-! nzb_2d replaced by nzb_u_inner
 !
 ! Revision 1.1  1997/08/11 06:09:21  raasch
@@ -68,13 +62,27 @@
     SUBROUTINE advec_u_pw
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxlu, nxr, nyn, nys, nzb_u_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  gu, gv
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+       
+       REAL(wp)    ::  gu !:
+       REAL(wp)    ::  gv !:
  
        gu = 2.0 * u_gtrans
@@ -104,13 +112,27 @@
     SUBROUTINE advec_u_pw_ij( i, j )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nzb_u_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  gu, gv
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+       
+       REAL(wp)    ::  gu !:
+       REAL(wp)    ::  gv !:
 
        gu = 2.0 * u_gtrans
Index: /palm/trunk/SOURCE/advec_u_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_u_up.f90	(revision 1319)
+++ /palm/trunk/SOURCE/advec_u_up.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,15 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 106 2007-08-16 14:30:26Z raasch
-! i loop is starting from nxlu (needed for non-cyclic boundary conditions)
-!
-! 75 2007-03-22 09:54:05Z raasch
-! uxrp eliminated
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.12  2006/02/23 09:45:04  raasch
-! nzb_2d replaced by nzb_u_inner
 !
 ! Revision 1.1  1997/08/29 08:55:25  raasch
@@ -67,16 +61,30 @@
     SUBROUTINE advec_u_up
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxlu, nxr, nyn, nys, nzb_u_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL ::  ukomp, vkomp, wkomp
-
-
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+
+       REAL(wp) ::  ukomp !:
+       REAL(wp) ::  vkomp !:
+       REAL(wp) ::  wkomp !:
+
+       
        DO  i = nxlu, nxr
           DO  j = nys, nyn
@@ -86,30 +94,30 @@
                 ukomp = u(k,j,i) - u_gtrans
                 IF ( ukomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - ukomp * &
+                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( u(k,j,i) - u(k,j,i-1) ) * ddx
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - ukomp * &
+                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                           ( u(k,j,i+1) - u(k,j,i) ) * ddx
                 ENDIF
 !
 !--             y-direction
-                vkomp = 0.25 * ( v(k,j,i)   + v(k,j+1,i) + &
+                vkomp = 0.25 * ( v(k,j,i)   + v(k,j+1,i) +                     &
                                  v(k,j,i-1) + v(k,j+1,i-1) ) - v_gtrans
                 IF ( vkomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - vkomp * &
+                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( u(k,j,i) - u(k,j-1,i) ) * ddy
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - vkomp * &
+                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( u(k,j+1,i) - u(k,j,i) ) * ddy
                 ENDIF
 !
 !--             z-direction
-                wkomp = 0.25 * ( w(k,j,i)   + w(k-1,j,i) + &
+                wkomp = 0.25 * ( w(k,j,i)   + w(k-1,j,i) +                     &
                                  w(k,j,i-1) + w(k-1,j,i-1) )
                 IF ( wkomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - wkomp * &
+                   tend(k,j,i) = tend(k,j,i) - wkomp *                         &
                                          ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k)
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - wkomp * &
+                   tend(k,j,i) = tend(k,j,i) - wkomp *                         &
                                          ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1)
                 ENDIF
@@ -127,14 +135,28 @@
     SUBROUTINE advec_u_up_ij( i, j )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nzb_u_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL ::  ukomp, vkomp, wkomp
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+
+       REAL(wp) ::  ukomp !:
+       REAL(wp) ::  vkomp !:
+       REAL(wp) ::  wkomp !:
 
 
@@ -144,19 +166,19 @@
           ukomp = u(k,j,i) - u_gtrans
           IF ( ukomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - ukomp * &
+             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( u(k,j,i) - u(k,j,i-1) ) * ddx
           ELSE
-             tend(k,j,i) = tend(k,j,i) - ukomp * &
+             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( u(k,j,i+1) - u(k,j,i) ) * ddx
           ENDIF
 !
 !--       y-direction
-          vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + v(k,j,i-1) + v(k,j+1,i-1) &
+          vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + v(k,j,i-1) + v(k,j+1,i-1)   &
                          ) - v_gtrans
           IF ( vkomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - vkomp * &
+             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( u(k,j,i) - u(k,j-1,i) ) * ddy
           ELSE
-             tend(k,j,i) = tend(k,j,i) - vkomp * &
+             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( u(k,j+1,i) - u(k,j,i) ) * ddy
           ENDIF
@@ -165,8 +187,8 @@
           wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + w(k,j,i-1) + w(k-1,j,i-1) )
           IF ( wkomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - wkomp * &
+             tend(k,j,i) = tend(k,j,i) - wkomp *                               &
                                          ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k)
           ELSE
-             tend(k,j,i) = tend(k,j,i) - wkomp * &
+             tend(k,j,i) = tend(k,j,i) - wkomp *                               &
                                          ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1)
           ENDIF
Index: /palm/trunk/SOURCE/advec_v_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_v_pw.f90	(revision 1319)
+++ /palm/trunk/SOURCE/advec_v_pw.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,15 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 106 2007-08-16 14:30:26Z raasch
-! j loop is starting from nysv (needed for non-cyclic boundary conditions)
-!
-! 75 2007-03-22 09:54:05Z raasch
-! vynp eliminated
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.15  2006/02/23 09:46:08  raasch
-! nzb_2d replaced by nzb_v_inner
 !
 ! Revision 1.1  1997/08/11 06:09:57  raasch
@@ -68,13 +62,27 @@
     SUBROUTINE advec_v_pw
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nysv, nzb_v_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  gu, gv
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+       
+       REAL(wp)    ::  gu !:
+       REAL(wp)    ::  gv !:
  
 
@@ -105,13 +113,27 @@
     SUBROUTINE advec_v_pw_ij( i, j )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nzb_v_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  gu, gv
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+       
+       REAL(wp)    ::  gu !:
+       REAL(wp)    ::  gv !:
 
 
@@ -119,5 +141,5 @@
        gv = 2.0 * v_gtrans
        DO  k = nzb_v_inner(j,i)+1, nzt
-          tend(k,j,i) = tend(k,j,i) - 0.25 * (                              &
+          tend(k,j,i) = tend(k,j,i) - 0.25 * (                                 &
                          ( v(k,j,i+1) * ( u(k,j-1,i+1) + u(k,j,i+1) - gu )     &
                          - v(k,j,i-1) * ( u(k,j-1,i) + u(k,j,i) - gu ) ) * ddx &
Index: /palm/trunk/SOURCE/advec_v_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_v_up.f90	(revision 1319)
+++ /palm/trunk/SOURCE/advec_v_up.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,15 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 106 2007-08-16 14:30:26Z raasch
-! j loop is starting from nysv (needed for non-cyclic boundary conditions)
-!
-! 75 2007-03-22 09:54:05Z raasch
-! vynp eliminated
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.12  2006/02/23 09:46:37  raasch
-! nzb_2d replaced by nzb_v_inner
 !
 ! Revision 1.1  1997/08/29 08:56:05  raasch
@@ -67,13 +61,28 @@
     SUBROUTINE advec_v_up
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nysv, nzb_v_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  ukomp, vkomp, wkomp
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+
+       REAL(wp) ::  ukomp !:
+       REAL(wp) ::  vkomp !:
+       REAL(wp) ::  wkomp !:       
 
 
@@ -83,11 +92,11 @@
 !
 !--             x-direction
-                ukomp = 0.25 * ( u(k,j,i)   + u(k,j-1,i) + &
+                ukomp = 0.25 * ( u(k,j,i)   + u(k,j-1,i) +                     &
                                  u(k,j,i+1) + u(k,j-1,i+1) ) - u_gtrans
                 IF ( ukomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - ukomp * &
+                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( v(k,j,i) - v(k,j,i-1) ) * ddx
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - ukomp * &
+                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( v(k,j,i+1) - v(k,j,i) ) * ddx
                 ENDIF
@@ -96,19 +105,19 @@
                 vkomp = v(k,j,i) - v_gtrans
                 IF ( vkomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - vkomp * &
+                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( v(k,j,i) - v(k,j-1,i) ) * ddy
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - vkomp * &
+                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( v(k,j+1,i) - v(k,j,i) ) * ddy
                 ENDIF
 !
 !--             z-direction
-                wkomp = 0.25 * ( w(k,j,i)  + w(k-1,j,i) + &
+                wkomp = 0.25 * ( w(k,j,i)  + w(k-1,j,i) +                      &
                                  w(k,j-1,i) + w(k-1,j-1,i) )
                 IF ( wkomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - wkomp * &
+                   tend(k,j,i) = tend(k,j,i) - wkomp *                         &
                                          ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - wkomp * &
+                   tend(k,j,i) = tend(k,j,i) - wkomp *                         &
                                          ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)
                 ENDIF
@@ -126,14 +135,28 @@
     SUBROUTINE advec_v_up_ij( i, j )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nzb_v_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL ::  ukomp, vkomp, wkomp
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+
+       REAL(wp) ::  ukomp !:
+       REAL(wp) ::  vkomp !:
+       REAL(wp) ::  wkomp !:
 
 
@@ -141,11 +164,11 @@
 !
 !--       x-direction
-          ukomp = 0.25 * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1) &
+          ukomp = 0.25 * ( u(k,j,i) + u(k,j-1,i) + u(k,j,i+1) + u(k,j-1,i+1)   &
                          ) - u_gtrans
           IF ( ukomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - ukomp * &
+             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( v(k,j,i) - v(k,j,i-1) ) * ddx
           ELSE
-             tend(k,j,i) = tend(k,j,i) - ukomp * &
+             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( v(k,j,i+1) - v(k,j,i) ) * ddx
           ENDIF
@@ -154,8 +177,8 @@
           vkomp = v(k,j,i) - v_gtrans
           IF ( vkomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - vkomp * &
+             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( v(k,j,i) - v(k,j-1,i) ) * ddy
           ELSE
-             tend(k,j,i) = tend(k,j,i) - vkomp * &
+             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( v(k,j+1,i) - v(k,j,i) ) * ddy
           ENDIF
@@ -164,8 +187,8 @@
           wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + w(k,j-1,i) + w(k-1,j-1,i) )
           IF ( wkomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - wkomp * &
+             tend(k,j,i) = tend(k,j,i) - wkomp *                               &
                                          ( v(k,j,i) - v(k-1,j,i) ) * ddzu(k)
           ELSE
-             tend(k,j,i) = tend(k,j,i) - wkomp * &
+             tend(k,j,i) = tend(k,j,i) - wkomp *                               &
                                          ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)
           ENDIF
Index: /palm/trunk/SOURCE/advec_w_pw.f90
===================================================================
--- /palm/trunk/SOURCE/advec_w_pw.f90	(revision 1319)
+++ /palm/trunk/SOURCE/advec_w_pw.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,9 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.15  2006/02/23 09:47:01  raasch
-! nzb_2d replaced by nzb_w_inner
 !
 ! Revision 1.1  1997/08/11 06:10:29  raasch
@@ -62,13 +62,27 @@
     SUBROUTINE advec_w_pw
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb_w_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  gu, gv
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+       
+       REAL(wp)    ::  gu !:
+       REAL(wp)    ::  gv !:
 
  
@@ -99,18 +113,32 @@
     SUBROUTINE advec_w_pw_ij( i, j )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nzb_w_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  gu, gv
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+       
+       REAL(wp)    ::  gu !:
+       REAL(wp)    ::  gv !:
 
        gu = 2.0 * u_gtrans
        gv = 2.0 * v_gtrans
        DO  k = nzb_w_inner(j,i)+1, nzt
-          tend(k,j,i) = tend(k,j,i) - 0.25 * (                              &
+          tend(k,j,i) = tend(k,j,i) - 0.25 * (                                 &
                          ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu )     &
                          - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx &
Index: /palm/trunk/SOURCE/advec_w_up.f90
===================================================================
--- /palm/trunk/SOURCE/advec_w_up.f90	(revision 1319)
+++ /palm/trunk/SOURCE/advec_w_up.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,9 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.11  2006/02/23 09:47:23  raasch
-! *** empty log message ***
 !
 ! Revision 1.1  1997/08/29 08:56:33  raasch
@@ -61,13 +61,27 @@
     SUBROUTINE advec_w_up
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb_w_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  ukomp, vkomp
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+
+       REAL(wp) ::  ukomp !:
+       REAL(wp) ::  vkomp !:
 
 
@@ -77,22 +91,22 @@
 !
 !--             x-direction
-                ukomp = 0.25 * ( u(k,j,i)   + u(k,j,i+1) + &
+                ukomp = 0.25 * ( u(k,j,i)   + u(k,j,i+1) +                     &
                                  u(k+1,j,i) + u(k+1,j,i+1) ) - u_gtrans
                 IF ( ukomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - ukomp * &
+                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( w(k,j,i) - w(k,j,i-1) ) * ddx
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - ukomp * &
+                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
                                          ( w(k,j,i+1) - w(k,j,i) ) * ddx
                 ENDIF
 !
 !--             y-direction
-                vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + &
+                vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) +                       &
                                  v(k+1,j,i) + v(k+1,j+1,i) ) - v_gtrans
                 IF ( vkomp > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - vkomp * &
+                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( w(k,j,i) - w(k,j-1,i) ) * ddy
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - vkomp * &
+                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
                                          ( w(k,j+1,i) - w(k,j,i) ) * ddy
                 ENDIF
@@ -100,8 +114,8 @@
 !--             z-direction
                 IF ( w(k,j,i) > 0.0 )  THEN
-                   tend(k,j,i) = tend(k,j,i) - w(k,j,i) * &
+                   tend(k,j,i) = tend(k,j,i) - w(k,j,i) *                      &
                                          ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k)
                 ELSE
-                   tend(k,j,i) = tend(k,j,i) - w(k,j,i) * &
+                   tend(k,j,i) = tend(k,j,i) - w(k,j,i) *                      &
                                          ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1)
                 ENDIF
@@ -119,13 +133,27 @@
     SUBROUTINE advec_w_up_ij( i, j )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nzb_w_inner, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  ukomp, vkomp
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+
+       REAL(wp) ::  ukomp !:
+       REAL(wp) ::  vkomp !:
 
 
@@ -133,22 +161,22 @@
 !
 !--       x-direction
-          ukomp = 0.25 * ( u(k,j,i) + u(k,j,i+1) + u(k+1,j,i) + u(k+1,j,i+1) &
+          ukomp = 0.25 * ( u(k,j,i) + u(k,j,i+1) + u(k+1,j,i) + u(k+1,j,i+1)   &
                          ) - u_gtrans
           IF ( ukomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - ukomp * &
+             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( w(k,j,i) - w(k,j,i-1) ) * ddx
           ELSE
-             tend(k,j,i) = tend(k,j,i) - ukomp * &
+             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
                                          ( w(k,j,i+1) - w(k,j,i) ) * ddx
           ENDIF
 !
 !--       y-direction
-          vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + v(k+1,j,i) + v(k+1,j+1,i) &
+          vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + v(k+1,j,i) + v(k+1,j+1,i)   &
                          ) - v_gtrans
           IF ( vkomp > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - vkomp * &
+             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( w(k,j,i) - w(k,j-1,i) ) * ddy
           ELSE
-             tend(k,j,i) = tend(k,j,i) - vkomp * &
+             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
                                          ( w(k,j+1,i) - w(k,j,i) ) * ddy
           ENDIF
@@ -156,8 +184,8 @@
 !--       z-direction
           IF ( w(k,j,i) > 0.0 )  THEN
-             tend(k,j,i) = tend(k,j,i) - w(k,j,i) * &
+             tend(k,j,i) = tend(k,j,i) - w(k,j,i) *                            &
                                          ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k)
           ELSE
-             tend(k,j,i) = tend(k,j,i) - w(k,j,i) * &
+             tend(k,j,i) = tend(k,j,i) - w(k,j,i) *                            &
                                          ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1)
           ENDIF
Index: /palm/trunk/SOURCE/advec_ws.f90
===================================================================
--- /palm/trunk/SOURCE/advec_ws.f90	(revision 1319)
+++ /palm/trunk/SOURCE/advec_ws.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -85,34 +91,4 @@
 ! dimension.
 !
-! 743 2011-08-18 16:10:16Z suehring
-! Evaluation of turbulent fluxes with WS-scheme only for the whole model 
-! domain. Therefor dimension of arrays needed for statistical evaluation 
-! decreased.
-!
-! 736 2011-08-17 14:13:26Z suehring 
-! Bugfix concerning OpenMP parallelization. i_omp introduced, because first
-! index where fluxes on left side have to be calculated explicitly is 
-! different on each thread. Furthermore the swapping of fluxes is now 
-! thread-safe by adding an additional dimension.
-!
-! 713 2011-03-30 14:21:21Z suehring
-! File reformatted.
-! Bugfix in vertical advection of w concerning the optimized version for   
-! vector architecture.
-! Constants adv_mom_3, adv_mom_5, adv_sca_5, adv_sca_3 reformulated as
-! broken numbers.
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 705 2011-03-25 11:21:43 Z suehring $
-! Bugfix in declaration of logicals concerning outflow boundaries.
-! 
-! 411 2009-12-11 12:31:43 Z suehring 
-! Allocation of weight_substep moved to init_3d_model. 
-! Declaration of ws_scheme_sca and ws_scheme_mom moved to check_parameters.
-! Setting bc for the horizontal velocity variances added (moved from 
-! flow_statistics).
-!
 ! Initial revision
 !
@@ -186,10 +162,31 @@
     SUBROUTINE ws_init
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  diss_l_e, diss_l_nr, diss_l_pt, diss_l_q, diss_l_qr,         &
+                  diss_l_sa, diss_l_u, diss_l_v, diss_l_w,  flux_l_e,          &
+                  flux_l_nr, flux_l_pt, flux_l_q, flux_l_qr, flux_l_sa,        &
+                  flux_l_u, flux_l_v, flux_l_w, diss_s_e, diss_s_nr, diss_s_pt,&
+                  diss_s_q, diss_s_qr, diss_s_sa, diss_s_u, diss_s_v, diss_s_w,& 
+                  flux_s_e, flux_s_nr, flux_s_pt, flux_s_q, flux_s_qr,         &
+                  flux_s_sa, flux_s_u, flux_s_v, flux_s_w
+
+       USE constants,                                                          &
+           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5, adv_sca_1, adv_sca_3,       &
+                  adv_sca_5
+
+       USE control_parameters,                                                 &
+           ONLY:  cloud_physics, humidity, icloud_scheme, loop_optimization,   &
+                  passive_scalar, precipitation, ocean, ws_scheme_mom,         &
+                  ws_scheme_sca
+
+       USE indices,                                                            &
+           ONLY:  nyn, nys, nzb, nzt  
+       
        USE pegrid
-       USE statistics
+
+       USE statistics,                                                         &
+           ONLY:  sums_us2_ws_l, sums_vs2_ws_l, sums_ws2_ws_l, sums_wsnrs_ws_l,&
+                  sums_wspts_ws_l, sums_wsqrs_ws_l, sums_wsqs_ws_l,            &
+                  sums_wssas_ws_l,  sums_wsus_ws_l, sums_wsvs_ws_l  
 
 !
@@ -205,8 +202,8 @@
        IF ( ws_scheme_mom )  THEN
 
-          ALLOCATE( sums_wsus_ws_l(nzb:nzt+1,0:threads_per_task-1),  &
-                    sums_wsvs_ws_l(nzb:nzt+1,0:threads_per_task-1),  &
-                    sums_us2_ws_l(nzb:nzt+1,0:threads_per_task-1),   &
-                    sums_vs2_ws_l(nzb:nzt+1,0:threads_per_task-1),   &
+          ALLOCATE( sums_wsus_ws_l(nzb:nzt+1,0:threads_per_task-1),            &
+                    sums_wsvs_ws_l(nzb:nzt+1,0:threads_per_task-1),            &
+                    sums_us2_ws_l(nzb:nzt+1,0:threads_per_task-1),             &
+                    sums_vs2_ws_l(nzb:nzt+1,0:threads_per_task-1),             &
                     sums_ws2_ws_l(nzb:nzt+1,0:threads_per_task-1) )
 
@@ -229,5 +226,5 @@
           ENDIF
 
-          IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
+          IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.                 &
                precipitation )  THEN
              ALLOCATE( sums_wsqrs_ws_l(nzb:nzt+1,0:threads_per_task-1) )
@@ -253,15 +250,15 @@
           IF ( ws_scheme_mom )  THEN
 
-             ALLOCATE( flux_s_u(nzb+1:nzt,0:threads_per_task-1),            &
-                       flux_s_v(nzb+1:nzt,0:threads_per_task-1),            &
-                       flux_s_w(nzb+1:nzt,0:threads_per_task-1),            &
-                       diss_s_u(nzb+1:nzt,0:threads_per_task-1),            &
-                       diss_s_v(nzb+1:nzt,0:threads_per_task-1),            &
+             ALLOCATE( flux_s_u(nzb+1:nzt,0:threads_per_task-1),               &
+                       flux_s_v(nzb+1:nzt,0:threads_per_task-1),               &
+                       flux_s_w(nzb+1:nzt,0:threads_per_task-1),               &
+                       diss_s_u(nzb+1:nzt,0:threads_per_task-1),               &
+                       diss_s_v(nzb+1:nzt,0:threads_per_task-1),               &
                        diss_s_w(nzb+1:nzt,0:threads_per_task-1) )
-             ALLOCATE( flux_l_u(nzb+1:nzt,nys:nyn,0:threads_per_task-1),    &
-                       flux_l_v(nzb+1:nzt,nys:nyn,0:threads_per_task-1),    &
-                       flux_l_w(nzb+1:nzt,nys:nyn,0:threads_per_task-1),    &
-                       diss_l_u(nzb+1:nzt,nys:nyn,0:threads_per_task-1),    &
-                       diss_l_v(nzb+1:nzt,nys:nyn,0:threads_per_task-1),    &
+             ALLOCATE( flux_l_u(nzb+1:nzt,nys:nyn,0:threads_per_task-1),       &
+                       flux_l_v(nzb+1:nzt,nys:nyn,0:threads_per_task-1),       &
+                       flux_l_w(nzb+1:nzt,nys:nyn,0:threads_per_task-1),       &
+                       diss_l_u(nzb+1:nzt,nys:nyn,0:threads_per_task-1),       &
+                       diss_l_v(nzb+1:nzt,nys:nyn,0:threads_per_task-1),       &
                        diss_l_w(nzb+1:nzt,nys:nyn,0:threads_per_task-1) )
 
@@ -270,36 +267,36 @@
           IF ( ws_scheme_sca )  THEN
 
-             ALLOCATE( flux_s_pt(nzb+1:nzt,0:threads_per_task-1),           &
-                       flux_s_e(nzb+1:nzt,0:threads_per_task-1),            &
-                       diss_s_pt(nzb+1:nzt,0:threads_per_task-1),           &
+             ALLOCATE( flux_s_pt(nzb+1:nzt,0:threads_per_task-1),              &
+                       flux_s_e(nzb+1:nzt,0:threads_per_task-1),               &
+                       diss_s_pt(nzb+1:nzt,0:threads_per_task-1),              &
                        diss_s_e(nzb+1:nzt,0:threads_per_task-1) ) 
-             ALLOCATE( flux_l_pt(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
-                       flux_l_e(nzb+1:nzt,nys:nyn,0:threads_per_task-1),    &
-                       diss_l_pt(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
+             ALLOCATE( flux_l_pt(nzb+1:nzt,nys:nyn,0:threads_per_task-1),      &
+                       flux_l_e(nzb+1:nzt,nys:nyn,0:threads_per_task-1),       &
+                       diss_l_pt(nzb+1:nzt,nys:nyn,0:threads_per_task-1),      &
                        diss_l_e(nzb+1:nzt,nys:nyn,0:threads_per_task-1) )
 
              IF ( humidity  .OR.  passive_scalar )  THEN
-                ALLOCATE( flux_s_q(nzb+1:nzt,0:threads_per_task-1),          &
+                ALLOCATE( flux_s_q(nzb+1:nzt,0:threads_per_task-1),            &
                           diss_s_q(nzb+1:nzt,0:threads_per_task-1) )
-                ALLOCATE( flux_l_q(nzb+1:nzt,nys:nyn,0:threads_per_task-1),  &
+                ALLOCATE( flux_l_q(nzb+1:nzt,nys:nyn,0:threads_per_task-1),    &
                           diss_l_q(nzb+1:nzt,nys:nyn,0:threads_per_task-1) )
              ENDIF
 
-             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.            &
+             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.              &
                   precipitation )  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 ( ocean )  THEN
-                ALLOCATE( flux_s_sa(nzb+1:nzt,0:threads_per_task-1),         &
+                ALLOCATE( flux_s_sa(nzb+1:nzt,0:threads_per_task-1),           &
                           diss_s_sa(nzb+1:nzt,0:threads_per_task-1) )
-                ALLOCATE( flux_l_sa(nzb+1:nzt,nys:nyn,0:threads_per_task-1), &
+                ALLOCATE( flux_l_sa(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
                           diss_l_sa(nzb+1:nzt,nys:nyn,0:threads_per_task-1) )
              ENDIF
@@ -317,6 +314,12 @@
     SUBROUTINE ws_statistics
     
-       USE control_parameters
-       USE statistics
+       USE control_parameters,                                                 &
+           ONLY:  cloud_physics, humidity, icloud_scheme, passive_scalar,      &
+                  precipitation, ocean, ws_scheme_mom, ws_scheme_sca
+
+       USE statistics,                                                         &
+           ONLY:  sums_us2_ws_l, sums_vs2_ws_l, sums_ws2_ws_l, sums_wsnrs_ws_l,&
+                  sums_wspts_ws_l, sums_wsqrs_ws_l, sums_wsqs_ws_l,            &
+                  sums_wssas_ws_l,  sums_wsus_ws_l, sums_wsvs_ws_l  
 
        IMPLICIT NONE
@@ -336,5 +339,5 @@
           sums_wspts_ws_l = 0.0
           IF ( humidity  .OR.  passive_scalar )  sums_wsqs_ws_l = 0.0
-          IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
+          IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.                 &
                precipitation )  THEN
              sums_wsqrs_ws_l = 0.0
@@ -351,34 +354,77 @@
 ! Scalar advection - Call for grid point i,j
 !------------------------------------------------------------------------------!
-    SUBROUTINE advec_s_ws_ij( i, j, sk, sk_char, swap_flux_y_local,  &
-                              swap_diss_y_local, swap_flux_x_local,  &
+    SUBROUTINE advec_s_ws_ij( i, j, sk, sk_char, swap_flux_y_local,            &
+                              swap_diss_y_local, swap_flux_x_local,            &
                               swap_diss_x_local, i_omp, tn )
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_sca_1, adv_sca_3, adv_sca_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans 
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb, nzb_max, nzt, wall_flags_0
+
+       USE kinds
+
        USE pegrid
-       USE statistics
+
+       USE statistics,                                                         &
+           ONLY:  sums_wsnrs_ws_l, sums_wspts_ws_l, sums_wsqrs_ws_l,           &
+                  sums_wsqs_ws_l, sums_wssas_ws_l, weight_substep
 
        IMPLICIT NONE
 
-       INTEGER ::  i, ibit0, ibit1, ibit2, ibit3, ibit4, ibit5, ibit6,        &
-                   ibit7, ibit8, i_omp, j, k, k_mm, k_pp, k_ppp,  tn
-       REAL    ::  diss_d, div, flux_d, u_comp, v_comp
+       CHARACTER (LEN = *), INTENT(IN) ::  sk_char !:
+       
+       INTEGER(iwp) ::  i     !:
+       INTEGER(iwp) ::  ibit0 !:
+       INTEGER(iwp) ::  ibit1 !:
+       INTEGER(iwp) ::  ibit2 !:
+       INTEGER(iwp) ::  ibit3 !:
+       INTEGER(iwp) ::  ibit4 !:
+       INTEGER(iwp) ::  ibit5 !:
+       INTEGER(iwp) ::  ibit6 !:
+       INTEGER(iwp) ::  ibit7 !:
+       INTEGER(iwp) ::  ibit8 !:
+       INTEGER(iwp) ::  i_omp !:
+       INTEGER(iwp) ::  j     !:
+       INTEGER(iwp) ::  k     !:
+       INTEGER(iwp) ::  k_mm  !:
+       INTEGER(iwp) ::  k_pp  !:
+       INTEGER(iwp) ::  k_ppp !:
+       INTEGER(iwp) ::  tn    !:
+       
+       REAL(wp)     ::  diss_d !:
+       REAL(wp)     ::  div    !:
+       REAL(wp)     ::  flux_d !:
+       REAL(wp)     ::  u_comp !:
+       REAL(wp)     ::  v_comp !:
+       
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER    ::  sk
+       REAL(wp), DIMENSION(:,:,:), POINTER    ::  sk     !:
 #endif
-       REAL, DIMENSION(nzb:nzt+1)         ::  diss_n, diss_r, diss_t, flux_n,  &
-                                              flux_r, flux_t
-       REAL, DIMENSION(nzb+1:nzt,0:threads_per_task-1) ::  swap_diss_y_local,  &
-                                                           swap_flux_y_local
-       REAL, DIMENSION(nzb+1:nzt,nys:nyn,0:threads_per_task-1) ::              &
-                                                          swap_diss_x_local,   &
-                                                          swap_flux_x_local
-       CHARACTER (LEN = *), INTENT(IN)    ::  sk_char
+       REAL(wp), DIMENSION(nzb:nzt+1)         ::  diss_n !:
+       REAL(wp), DIMENSION(nzb:nzt+1)         ::  diss_r !:
+       REAL(wp), DIMENSION(nzb:nzt+1)         ::  diss_t !:
+       REAL(wp), DIMENSION(nzb:nzt+1)         ::  flux_n !:
+       REAL(wp), DIMENSION(nzb:nzt+1)         ::  flux_r !:
+       REAL(wp), DIMENSION(nzb:nzt+1)         ::  flux_t !:
+       
+       REAL(wp), DIMENSION(nzb+1:nzt,0:threads_per_task-1) ::  swap_diss_y_local !:
+       REAL(wp), DIMENSION(nzb+1:nzt,0:threads_per_task-1) ::  swap_flux_y_local !:
+       
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn,0:threads_per_task-1) ::  swap_diss_x_local !:
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn,0:threads_per_task-1) ::  swap_flux_x_local !:
+       
 
 !
@@ -800,18 +846,60 @@
     SUBROUTINE advec_u_ws_ij( i, j, i_omp, tn )
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, diss_l_u, diss_s_u, flux_l_u, flux_s_u, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb, nzb_max, nzt, wall_flags_0
+
+       USE kinds
+
+       USE statistics,                                                         &
+           ONLY:  hom, sums_us2_ws_l, sums_wsus_ws_l, weight_substep
 
        IMPLICIT NONE
 
-       INTEGER ::  i, ibit9, ibit10, ibit11, ibit12, ibit13, ibit14, ibit15,  &
-                   ibit16, ibit17, i_omp, j, k, k_mm, k_pp, k_ppp, tn
-       REAL    ::  diss_d, div, flux_d, gu, gv, u_comp_l, v_comp, w_comp
-       REAL, DIMENSION(nzb:nzt+1) :: diss_n, diss_r, diss_t, flux_n, flux_r,  &
-                                     flux_t, u_comp
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  ibit9  !:
+       INTEGER(iwp) ::  ibit10 !:
+       INTEGER(iwp) ::  ibit11 !:
+       INTEGER(iwp) ::  ibit12 !:
+       INTEGER(iwp) ::  ibit13 !:
+       INTEGER(iwp) ::  ibit14 !:
+       INTEGER(iwp) ::  ibit15 !:
+       INTEGER(iwp) ::  ibit16 !:
+       INTEGER(iwp) ::  ibit17 !:
+       INTEGER(iwp) ::  i_omp  !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_mm   !:
+       INTEGER(iwp) ::  k_pp   !:
+       INTEGER(iwp) ::  k_ppp  !:
+       INTEGER(iwp) ::  tn     !:
+       
+       REAL(wp)    ::  diss_d   !:
+       REAL(wp)    ::  div      !:
+       REAL(wp)    ::  flux_d   !:
+       REAL(wp)    ::  gu       !:
+       REAL(wp)    ::  gv       !:
+       REAL(wp)    ::  u_comp_l !:
+       REAL(wp)    ::  v_comp   !:
+       REAL(wp)    ::  w_comp   !:
+       
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  diss_n !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  diss_r !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  diss_t !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  flux_n !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  flux_r !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  flux_t !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  u_comp !:
 
        gu = 2.0 * u_gtrans
@@ -1212,18 +1300,60 @@
    SUBROUTINE advec_v_ws_ij( i, j, i_omp, tn )
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, diss_l_v, diss_s_v, flux_l_v, flux_s_v, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nysv, nzb, nzb_max, nzt, wall_flags_0
+
+       USE kinds
+
+       USE statistics,                                                         &
+           ONLY:  hom, sums_vs2_ws_l, sums_wsvs_ws_l, weight_substep
 
        IMPLICIT NONE
 
-       INTEGER  ::  i, ibit18, ibit19, ibit20, ibit21, ibit22, ibit23, ibit24, &
-                    ibit25, ibit26, i_omp, j, k, k_mm, k_pp, k_ppp, tn
-       REAL     ::  diss_d, div, flux_d, gu, gv, u_comp, v_comp_l, w_comp
-       REAL, DIMENSION(nzb:nzt+1)  :: diss_n, diss_r, diss_t, flux_n, flux_r,  &
-                                      flux_t, v_comp
+       INTEGER(iwp)  ::  i      !:
+       INTEGER(iwp)  ::  ibit18 !:
+       INTEGER(iwp)  ::  ibit19 !:
+       INTEGER(iwp)  ::  ibit20 !:
+       INTEGER(iwp)  ::  ibit21 !:
+       INTEGER(iwp)  ::  ibit22 !:
+       INTEGER(iwp)  ::  ibit23 !:
+       INTEGER(iwp)  ::  ibit24 !:
+       INTEGER(iwp)  ::  ibit25 !:
+       INTEGER(iwp)  ::  ibit26 !:
+       INTEGER(iwp)  ::  i_omp  !:
+       INTEGER(iwp)  ::  j      !:
+       INTEGER(iwp)  ::  k      !:
+       INTEGER(iwp)  ::  k_mm   !:
+       INTEGER(iwp)  ::  k_pp   !:
+       INTEGER(iwp)  ::  k_ppp  !:
+       INTEGER(iwp)  ::  tn     !:
+       
+       REAL(wp)     ::  diss_d   !:
+       REAL(wp)     ::  div      !:
+       REAL(wp)     ::  flux_d   !:
+       REAL(wp)     ::  gu       !:
+       REAL(wp)     ::  gv       !:
+       REAL(wp)     ::  u_comp   !:
+       REAL(wp)     ::  v_comp_l !:
+       REAL(wp)     ::  w_comp   !:
+       
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  diss_n !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  diss_r !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  diss_t !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  flux_n !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  flux_r !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  flux_t !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  v_comp !:
 
        gu = 2.0 * u_gtrans
@@ -1631,18 +1761,60 @@
     SUBROUTINE advec_w_ws_ij( i, j, i_omp, tn )
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, diss_l_w, diss_s_w, flux_l_w, flux_s_w, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb, nzb_max, nzt, wall_flags_0,         &
+                  wall_flags_00
+
+       USE kinds
+       
+       USE statistics,                                                         &
+           ONLY:  hom, sums_ws2_ws_l, weight_substep
 
        IMPLICIT NONE
 
-       INTEGER ::  i, ibit27, ibit28, ibit29, ibit30, ibit31, ibit32, ibit33, &
-                   ibit34, ibit35, i_omp, j, k, k_mm, k_pp, k_ppp, tn
-       REAL    ::  diss_d, div, flux_d, gu, gv, u_comp, v_comp, w_comp
-       REAL, DIMENSION(nzb:nzt+1)  :: diss_n, diss_r, diss_t, flux_n, flux_r, &
-                                      flux_t
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  ibit27 !:
+       INTEGER(iwp) ::  ibit28 !:
+       INTEGER(iwp) ::  ibit29 !:
+       INTEGER(iwp) ::  ibit30 !:
+       INTEGER(iwp) ::  ibit31 !:
+       INTEGER(iwp) ::  ibit32 !:
+       INTEGER(iwp) ::  ibit33 !:
+       INTEGER(iwp) ::  ibit34 !:
+       INTEGER(iwp) ::  ibit35 !:
+       INTEGER(iwp) ::  i_omp  !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_mm   !:
+       INTEGER(iwp) ::  k_pp   !:
+       INTEGER(iwp) ::  k_ppp  !:
+       INTEGER(iwp) ::  tn     !:
+       
+       REAL(wp)    ::  diss_d  !:
+       REAL(wp)    ::  div     !:
+       REAL(wp)    ::  flux_d  !:
+       REAL(wp)    ::  gu      !:
+       REAL(wp)    ::  gv      !:
+       REAL(wp)    ::  u_comp  !:
+       REAL(wp)    ::  v_comp  !:
+       REAL(wp)    ::  w_comp  !:
+       
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  diss_n !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  diss_r !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  diss_t !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  flux_n !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  flux_r !:
+       REAL(wp), DIMENSION(nzb:nzt+1)  ::  flux_t !:
 
        gu = 2.0 * u_gtrans
@@ -2027,27 +2199,71 @@
     SUBROUTINE advec_s_ws( sk, sk_char )
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_sca_1, adv_sca_3, adv_sca_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans 
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb, nzb_max, nzt, wall_flags_0
+           
+       USE kinds
+       
+       USE statistics,                                                         &
+           ONLY:  sums_wspts_ws_l, sums_wsqs_ws_l, sums_wssas_ws_l,            &
+                  weight_substep
 
        IMPLICIT NONE
 
-       INTEGER ::  i, ibit0, ibit1, ibit2, ibit3, ibit4, ibit5, ibit6,        &
-                   ibit7, ibit8, j, k, k_mm, k_pp, k_ppp, tn = 0
+       CHARACTER (LEN = *), INTENT(IN)    ::  sk_char !:
+       
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  ibit0  !:
+       INTEGER(iwp) ::  ibit1  !:
+       INTEGER(iwp) ::  ibit2  !:
+       INTEGER(iwp) ::  ibit3  !:
+       INTEGER(iwp) ::  ibit4  !:
+       INTEGER(iwp) ::  ibit5  !:
+       INTEGER(iwp) ::  ibit6  !:
+       INTEGER(iwp) ::  ibit7  !:
+       INTEGER(iwp) ::  ibit8  !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_mm   !:
+       INTEGER(iwp) ::  k_pp   !:
+       INTEGER(iwp) ::  k_ppp  !:
+       INTEGER(iwp) ::  tn = 0 !:
+       
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  sk
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk !:
 #endif
-       REAL ::  diss_d, div, flux_d, u_comp, v_comp
-       REAL, DIMENSION(nzb:nzt)   ::  diss_n, diss_r, diss_t, flux_n, flux_r,  &
-                                      flux_t
-       REAL, DIMENSION(nzb+1:nzt) ::  swap_diss_y_local, swap_flux_y_local
-       REAL, DIMENSION(nzb+1:nzt,nys:nyn) ::  swap_diss_x_local,               &
-                                              swap_flux_x_local
-       CHARACTER (LEN = *), INTENT(IN)    ::  sk_char
+
+       REAL(wp) ::  diss_d !:
+       REAL(wp) ::  div    !:
+       REAL(wp) ::  flux_d !:
+       REAL(wp) ::  u_comp !:
+       REAL(wp) ::  v_comp !:
+       
+       REAL(wp), DIMENSION(nzb:nzt)   ::  diss_n !:
+       REAL(wp), DIMENSION(nzb:nzt)   ::  diss_r !:
+       REAL(wp), DIMENSION(nzb:nzt)   ::  diss_t !:
+       REAL(wp), DIMENSION(nzb:nzt)   ::  flux_n !:
+       REAL(wp), DIMENSION(nzb:nzt)   ::  flux_r !:
+       REAL(wp), DIMENSION(nzb:nzt)   ::  flux_t !:
+       
+       REAL(wp), DIMENSION(nzb+1:nzt) ::  swap_diss_y_local !:
+       REAL(wp), DIMENSION(nzb+1:nzt) ::  swap_flux_y_local !:
+       
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  swap_diss_x_local !:
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  swap_flux_x_local !:
+        
 
 !
@@ -2439,22 +2655,65 @@
     SUBROUTINE advec_s_ws_acc ( sk, sk_char )
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_sca_1, adv_sca_3, adv_sca_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nxlg, nxrg, nyng, nysg,   &
+                  nzb, nzb_max, nzt, wall_flags_0
+
+       USE kinds
+       
+!        USE statistics,                                                       &
+!            ONLY:  sums_wspts_ws_l, sums_wsqs_ws_l, sums_wssas_ws_l,          &
+!                   weight_substep
 
        IMPLICIT NONE
 
-       CHARACTER (LEN = *), INTENT(IN)    :: sk_char
-
-       INTEGER ::  i, ibit0, ibit1, ibit2, ibit3, ibit4, ibit5, ibit6,        &
-                   ibit7, ibit8, j, k, k_mm, k_mmm, k_pp, k_ppp, tn = 0
-
-       REAL    :: diss_d, diss_l, diss_n, diss_r, diss_s, diss_t, div, flux_d, &
-                  flux_l, flux_n, flux_r, flux_s, flux_t, u_comp, v_comp
-
-       REAL, INTENT(IN), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  ::  sk
+       CHARACTER (LEN = *), INTENT(IN)    :: sk_char !:
+
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  ibit0  !:
+       INTEGER(iwp) ::  ibit1  !:
+       INTEGER(iwp) ::  ibit2  !:
+       INTEGER(iwp) ::  ibit3  !:
+       INTEGER(iwp) ::  ibit4  !:
+       INTEGER(iwp) ::  ibit5  !:
+       INTEGER(iwp) ::  ibit6  !:
+       INTEGER(iwp) ::  ibit7  !:
+       INTEGER(iwp) ::  ibit8  !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_mm   !:
+       INTEGER(iwp) ::  k_mmm  !:
+       INTEGER(iwp) ::  k_pp   !:
+       INTEGER(iwp) ::  k_ppp  !:
+       INTEGER(iwp) ::  tn = 0 !:
+
+       REAL(wp)    ::  diss_d !:
+       REAL(wp)    ::  diss_l !:
+       REAL(wp)    ::  diss_n !:
+       REAL(wp)    ::  diss_r !:
+       REAL(wp)    ::  diss_s !:
+       REAL(wp)    ::  diss_t !:
+       REAL(wp)    ::  div    !:
+       REAL(wp)    ::  flux_d !:
+       REAL(wp)    ::  flux_l !:
+       REAL(wp)    ::  flux_n !:
+       REAL(wp)    ::  flux_r !:
+       REAL(wp)    ::  flux_s !:
+       REAL(wp)    ::  flux_t !:
+       REAL(wp)    ::  u_comp !:
+       REAL(wp)    ::  v_comp !:
+
+       REAL(wp), INTENT(IN), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  ::  sk !:
 
 !
@@ -2719,21 +2978,64 @@
     SUBROUTINE advec_u_ws
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxlu, nxr, nyn, nys, nzb, nzb_max, nzt, wall_flags_0
+           
+       USE kinds
+       
+       USE statistics,                                                         &
+           ONLY:  hom, sums_us2_ws_l, sums_wsus_ws_l, weight_substep
 
        IMPLICIT NONE
 
-       INTEGER ::  i, ibit9, ibit10, ibit11, ibit12, ibit13, ibit14, ibit15,   &
-                   ibit16, ibit17, j, k, k_mm, k_pp, k_ppp, tn = 0
-       REAL    ::  diss_d, div, flux_d, gu, gv, v_comp, w_comp
-       REAL, DIMENSION(nzb+1:nzt) :: swap_diss_y_local_u, swap_flux_y_local_u
-       REAL, DIMENSION(nzb+1:nzt,nys:nyn) :: swap_diss_x_local_u,              &
-                                             swap_flux_x_local_u
-       REAL, DIMENSION(nzb:nzt) :: diss_n, diss_r, diss_t, flux_n, flux_r,     &
-                                   flux_t, u_comp
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  ibit9  !:
+       INTEGER(iwp) ::  ibit10 !:
+       INTEGER(iwp) ::  ibit11 !:
+       INTEGER(iwp) ::  ibit12 !:
+       INTEGER(iwp) ::  ibit13 !:
+       INTEGER(iwp) ::  ibit14 !:
+       INTEGER(iwp) ::  ibit15 !:
+       INTEGER(iwp) ::  ibit16 !:
+       INTEGER(iwp) ::  ibit17 !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_mm   !:
+       INTEGER(iwp) ::  k_pp   !:
+       INTEGER(iwp) ::  k_ppp  !:
+       INTEGER(iwp) ::  tn = 0 !:
+       
+       REAL(wp)    ::  diss_d !:
+       REAL(wp)    ::  div    !:
+       REAL(wp)    ::  flux_d !:
+       REAL(wp)    ::  gu     !:
+       REAL(wp)    ::  gv     !:
+       REAL(wp)    ::  v_comp !:
+       REAL(wp)    ::  w_comp !:
+       
+       REAL(wp), DIMENSION(nzb+1:nzt) ::  swap_diss_y_local_u !:
+       REAL(wp), DIMENSION(nzb+1:nzt) ::  swap_flux_y_local_u !:
+       
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  swap_diss_x_local_u !:
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  swap_flux_x_local_u !:
+       
+       REAL(wp), DIMENSION(nzb:nzt) ::  diss_n !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  diss_r !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  diss_t !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  flux_n !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  flux_r !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  flux_t !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  u_comp !:
  
        gu = 2.0 * u_gtrans
@@ -3137,19 +3439,65 @@
     SUBROUTINE advec_u_ws_acc
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb,  &
+                  nzb_max, nzt, wall_flags_0
+           
+       USE kinds
+       
+!        USE statistics,                                                       &
+!            ONLY:  hom, sums_us2_ws_l, sums_wsus_ws_l, weight_substep
 
        IMPLICIT NONE
 
-       INTEGER ::  i, ibit9, ibit10, ibit11, ibit12, ibit13, ibit14, ibit15,   &
-                   ibit16, ibit17, j, k, k_mmm, k_mm, k_pp, k_ppp, tn = 0
-
-       REAL    ::  diss_d, diss_l, diss_n, diss_r, diss_s, diss_t, div,    &
-                   flux_d, flux_l, flux_n, flux_r, flux_s, flux_t, gu, gv, &
-                   u_comp, u_comp_l, v_comp, v_comp_s, w_comp
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  ibit9  !:
+       INTEGER(iwp) ::  ibit10 !:
+       INTEGER(iwp) ::  ibit11 !:
+       INTEGER(iwp) ::  ibit12 !:
+       INTEGER(iwp) ::  ibit13 !:
+       INTEGER(iwp) ::  ibit14 !:
+       INTEGER(iwp) ::  ibit15 !:
+       INTEGER(iwp) ::  ibit16 !:
+       INTEGER(iwp) ::  ibit17 !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_mmm  !:
+       INTEGER(iwp) ::  k_mm   !:
+       INTEGER(iwp) ::  k_pp   !:
+       INTEGER(iwp) ::  k_ppp  !:
+       INTEGER(iwp) ::  tn = 0 !:
+
+       REAL(wp)    ::  diss_d   !:
+       REAL(wp)    ::  diss_l   !:
+       REAL(wp)    ::  diss_n   !:
+       REAL(wp)    ::  diss_r   !:
+       REAL(wp)    ::  diss_s   !:
+       REAL(wp)    ::  diss_t   !:
+       REAL(wp)    ::  div      !:
+       REAL(wp)    ::  flux_d   !:
+       REAL(wp)    ::  flux_l   !:
+       REAL(wp)    ::  flux_n   !:
+       REAL(wp)    ::  flux_r   !:
+       REAL(wp)    ::  flux_s   !:
+       REAL(wp)    ::  flux_t   !:
+       REAL(wp)    ::  gu       !:
+       REAL(wp)    ::  gv       !:
+       REAL(wp)    ::  u_comp   !:
+       REAL(wp)    ::  u_comp_l !:
+       REAL(wp)    ::  v_comp   !:
+       REAL(wp)    ::  v_comp_s !:
+       REAL(wp)    ::  w_comp   !:
 
 
@@ -3424,22 +3772,65 @@
     SUBROUTINE advec_v_ws
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nysv, nzb, nzb_max, nzt, wall_flags_0
+
+       USE kinds
+
+       USE statistics,                                                         &
+           ONLY:  hom, sums_vs2_ws_l, sums_wsvs_ws_l, weight_substep
 
        IMPLICIT NONE
 
 
-       INTEGER ::  i, ibit18, ibit19, ibit20, ibit21, ibit22, ibit23, ibit24, &
-                    ibit25, ibit26, j, k, k_mm, k_pp, k_ppp, tn = 0
-       REAL    ::  diss_d, div, flux_d, gu, gv, u_comp, w_comp
-       REAL, DIMENSION(nzb+1:nzt) :: swap_diss_y_local_v, swap_flux_y_local_v
-       REAL, DIMENSION(nzb+1:nzt,nys:nyn) :: swap_diss_x_local_v,             &
-                                             swap_flux_x_local_v
-       REAL, DIMENSION(nzb:nzt) :: diss_n, diss_r, diss_t, flux_n, flux_r,    &
-                                   flux_t, v_comp
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  ibit18 !:
+       INTEGER(iwp) ::  ibit19 !:
+       INTEGER(iwp) ::  ibit20 !:
+       INTEGER(iwp) ::  ibit21 !:
+       INTEGER(iwp) ::  ibit22 !:
+       INTEGER(iwp) ::  ibit23 !:
+       INTEGER(iwp) ::  ibit24 !:
+       INTEGER(iwp) ::  ibit25 !:
+       INTEGER(iwp) ::  ibit26 !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_mm   !:
+       INTEGER(iwp) ::  k_pp   !:
+       INTEGER(iwp) ::  k_ppp  !:
+       INTEGER(iwp) ::  tn = 0 !:
+       
+       REAL(wp)    ::  diss_d !:
+       REAL(wp)    ::  div    !:
+       REAL(wp)    ::  flux_d !:
+       REAL(wp)    ::  gu     !:
+       REAL(wp)    ::  gv     !:
+       REAL(wp)    ::  u_comp !:
+       REAL(wp)    ::  w_comp !:
+       
+       REAL(wp), DIMENSION(nzb+1:nzt) ::  swap_diss_y_local_v !:
+       REAL(wp), DIMENSION(nzb+1:nzt) ::  swap_flux_y_local_v !:
+       
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  swap_diss_x_local_v !:
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  swap_flux_x_local_v !:
+       
+       REAL(wp), DIMENSION(nzb:nzt) ::  diss_n !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  diss_r !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  diss_t !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  flux_n !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  flux_r !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  flux_t !:
+       REAL(wp), DIMENSION(nzb:nzt) ::  v_comp !:
 
        gu = 2.0 * u_gtrans
@@ -3852,20 +4243,66 @@
     SUBROUTINE advec_v_ws_acc
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb,  &
+                  nzb_max, nzt, wall_flags_0
+           
+       USE kinds
+       
+!        USE statistics,                                                       &
+!            ONLY:  hom, sums_vs2_ws_l, sums_wsvs_ws_l, weight_substep
 
        IMPLICIT NONE
 
 
-       INTEGER ::  i, ibit18, ibit19, ibit20, ibit21, ibit22, ibit23, ibit24, &
-                    ibit25, ibit26, j, k, k_mm, k_mmm, k_pp, k_ppp, tn = 0
-
-       REAL    ::  diss_d, diss_l, diss_n, diss_r, diss_s, diss_t, div,    &
-                   flux_d, flux_l, flux_n, flux_r, flux_s, flux_t, gu, gv, &
-                   u_comp, u_comp_l, v_comp, v_comp_s, w_comp
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  ibit18 !:
+       INTEGER(iwp) ::  ibit19 !:
+       INTEGER(iwp) ::  ibit20 !:
+       INTEGER(iwp) ::  ibit21 !:
+       INTEGER(iwp) ::  ibit22 !:
+       INTEGER(iwp) ::  ibit23 !:
+       INTEGER(iwp) ::  ibit24 !:
+       INTEGER(iwp) ::  ibit25 !:
+       INTEGER(iwp) ::  ibit26 !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_mm   !:
+       INTEGER(iwp) ::  k_mmm  !:
+       INTEGER(iwp) ::  k_pp   !:
+       INTEGER(iwp) ::  k_ppp  !:
+       INTEGER(iwp) ::  tn = 0 !:
+
+       REAL(wp)    ::  diss_d   !:
+       REAL(wp)    ::  diss_l   !:
+       REAL(wp)    ::  diss_n   !:
+       REAL(wp)    ::  diss_r   !:
+       REAL(wp)    ::  diss_s   !:
+       REAL(wp)    ::  diss_t   !:
+       REAL(wp)    ::  div      !:
+       REAL(wp)    ::  flux_d   !:
+       REAL(wp)    ::  flux_l   !:
+       REAL(wp)    ::  flux_n   !:
+       REAL(wp)    ::  flux_r   !:
+       REAL(wp)    ::  flux_s   !:
+       REAL(wp)    ::  flux_t   !:
+       REAL(wp)    ::  gu       !:
+       REAL(wp)    ::  gv       !:
+       REAL(wp)    ::  u_comp   !:
+       REAL(wp)    ::  u_comp_l !:
+       REAL(wp)    ::  v_comp   !:
+       REAL(wp)    ::  v_comp_s !:
+       REAL(wp)    ::  w_comp   !:
 
        gu = 2.0 * u_gtrans
@@ -4141,22 +4578,65 @@
     SUBROUTINE advec_w_ws
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb, nzb_max, nzt, wall_flags_0,         &
+                  wall_flags_00
+
+       USE kinds
+       
+       USE statistics,                                                         &
+           ONLY:  hom, sums_ws2_ws_l, weight_substep
 
        IMPLICIT NONE
 
-       INTEGER ::  i, ibit27, ibit28, ibit29, ibit30, ibit31, ibit32, ibit33, &
-                   ibit34, ibit35, j, k, k_mm, k_pp, k_ppp, tn = 0
-       REAL    ::  diss_d, div, flux_d, gu, gv, u_comp, v_comp, w_comp
-       REAL, DIMENSION(nzb:nzt)    ::  diss_t, flux_t
-       REAL, DIMENSION(nzb+1:nzt)  ::  diss_n, diss_r, flux_n, flux_r,        &
-                                       swap_diss_y_local_w,                   &
-                                       swap_flux_y_local_w
-       REAL, DIMENSION(nzb+1:nzt,nys:nyn) :: swap_diss_x_local_w,             &
-                                             swap_flux_x_local_w
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  ibit27 !:
+       INTEGER(iwp) ::  ibit28 !:
+       INTEGER(iwp) ::  ibit29 !:
+       INTEGER(iwp) ::  ibit30 !:
+       INTEGER(iwp) ::  ibit31 !:
+       INTEGER(iwp) ::  ibit32 !:
+       INTEGER(iwp) ::  ibit33 !:
+       INTEGER(iwp) ::  ibit34 !:
+       INTEGER(iwp) ::  ibit35 !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_mm   !:
+       INTEGER(iwp) ::  k_pp   !:
+       INTEGER(iwp) ::  k_ppp  !:
+       INTEGER(iwp) ::  tn = 0 !:
+       
+       REAL(wp)    ::  diss_d !:
+       REAL(wp)    ::  div    !:
+       REAL(wp)    ::  flux_d !:
+       REAL(wp)    ::  gu     !:
+       REAL(wp)    ::  gv     !:
+       REAL(wp)    ::  u_comp !:
+       REAL(wp)    ::  v_comp !:
+       REAL(wp)    ::  w_comp !:
+       
+       REAL(wp), DIMENSION(nzb:nzt)    ::  diss_t !:
+       REAL(wp), DIMENSION(nzb:nzt)    ::  flux_t !:
+       
+       REAL(wp), DIMENSION(nzb+1:nzt)  ::  diss_n !:
+       REAL(wp), DIMENSION(nzb+1:nzt)  ::  diss_r !:
+       REAL(wp), DIMENSION(nzb+1:nzt)  ::  flux_n !:
+       REAL(wp), DIMENSION(nzb+1:nzt)  ::  flux_r !:
+       REAL(wp), DIMENSION(nzb+1:nzt)  ::  swap_diss_y_local_w !:
+       REAL(wp), DIMENSION(nzb+1:nzt)  ::  swap_flux_y_local_w !:
+       
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  swap_diss_x_local_w !:
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  swap_flux_x_local_w !:
  
        gu = 2.0 * u_gtrans
@@ -4546,19 +5026,65 @@
     SUBROUTINE advec_w_ws_acc
 
-       USE arrays_3d
-       USE constants
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, tend, u, v, w
+
+       USE constants,                                                          &
+           ONLY:  adv_mom_1, adv_mom_3, adv_mom_5
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, u_gtrans, v_gtrans
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy
+
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb,  &
+                  nzb_max, nzt, wall_flags_0, wall_flags_00
+           
+       USE kinds
+       
+!        USE statistics,                                                       &
+!            ONLY:  hom, sums_ws2_ws_l, weight_substep
 
        IMPLICIT NONE
 
-       INTEGER ::  i, ibit27, ibit28, ibit29, ibit30, ibit31, ibit32, ibit33, &
-                   ibit34, ibit35, j, k, k_mmm, k_mm, k_pp, k_ppp, tn = 0
-
-       REAL    ::  diss_d, diss_l, diss_n, diss_r, diss_s, diss_t, div,    &
-                   flux_d, flux_l, flux_n, flux_r, flux_s, flux_t, gu, gv, &
-                   u_comp, u_comp_l, v_comp, v_comp_s, w_comp
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  ibit27 !:
+       INTEGER(iwp) ::  ibit28 !:
+       INTEGER(iwp) ::  ibit29 !:
+       INTEGER(iwp) ::  ibit30 !:
+       INTEGER(iwp) ::  ibit31 !:
+       INTEGER(iwp) ::  ibit32 !:
+       INTEGER(iwp) ::  ibit33 !:
+       INTEGER(iwp) ::  ibit34 !:
+       INTEGER(iwp) ::  ibit35 !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_mmm  !:
+       INTEGER(iwp) ::  k_mm   !:
+       INTEGER(iwp) ::  k_pp   !:
+       INTEGER(iwp) ::  k_ppp  !:
+       INTEGER(iwp) ::  tn = 0 !:
+
+       REAL(wp)    ::  diss_d   !:
+       REAL(wp)    ::  diss_l   !:
+       REAL(wp)    ::  diss_n   !:
+       REAL(wp)    ::  diss_r   !:
+       REAL(wp)    ::  diss_s   !:
+       REAL(wp)    ::  diss_t   !:
+       REAL(wp)    ::  div      !:
+       REAL(wp)    ::  flux_d   !:
+       REAL(wp)    ::  flux_l   !:
+       REAL(wp)    ::  flux_n   !:
+       REAL(wp)    ::  flux_r   !:
+       REAL(wp)    ::  flux_s   !:
+       REAL(wp)    ::  flux_t   !:
+       REAL(wp)    ::  gu       !:
+       REAL(wp)    ::  gv       !:
+       REAL(wp)    ::  u_comp   !:
+       REAL(wp)    ::  u_comp_l !:
+       REAL(wp)    ::  v_comp   !:
+       REAL(wp)    ::  v_comp_s !:
+       REAL(wp)    ::  w_comp   !:
 
        gu = 2.0 * u_gtrans
Index: /palm/trunk/SOURCE/average_3d_data.f90
===================================================================
--- /palm/trunk/SOURCE/average_3d_data.f90	(revision 1319)
+++ /palm/trunk/SOURCE/average_3d_data.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -41,21 +46,4 @@
 ! 978 2012-08-09 08:28:32Z fricke
 ! +z0h_av
-!
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt_av
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 367 2009-08-25 08:35:52Z maronga
-! Added calculation of shf* and qsws*
-!
-! 96 2007-06-04 08:07:41Z raasch
-! Averaging of density and salinity
-!
-! 72 2007-03-19 08:20:46Z raasch
-! Averaging the precipitation rate and roughness length (prr*, z0*)
-!
-! RCS Log replace by Id keyword, revision history cleaned up
 !
 ! Revision 1.1  2006/02/23 09:48:58  raasch
@@ -68,14 +56,24 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
     USE averaging
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE indices
+
+    USE control_parameters,                                                    &
+        ONLY:  average_count_3d, doav, doav_n
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
+
+    USE kinds
+
 
     IMPLICIT NONE
 
-    INTEGER ::  i, ii, j, k
+    INTEGER(iwp) ::  i  !:
+    INTEGER(iwp) ::  ii !:
+    INTEGER(iwp) ::  j  !:
+    INTEGER(iwp) ::  k  !:
 
 
@@ -165,5 +163,5 @@
              DO  i = nxlg, nxrg
                 DO  j = nysg, nyng
-                   precipitation_rate_av(j,i) = precipitation_rate_av(j,i) / &
+                   precipitation_rate_av(j,i) = precipitation_rate_av(j,i) /   &
                                                 REAL( average_count_3d )
                 ENDDO
@@ -228,5 +226,5 @@
                 DO  j = nysg, nyng
                    DO  k = nzb, nzt+1
-                      ql_vp_av(k,j,i) = ql_vp_av(k,j,i) / &
+                      ql_vp_av(k,j,i) = ql_vp_av(k,j,i) /                      &
                                         REAL( average_count_3d )
                    ENDDO
Index: /palm/trunk/SOURCE/boundary_conds.f90
===================================================================
--- /palm/trunk/SOURCE/boundary_conds.f90	(revision 1319)
+++ /palm/trunk/SOURCE/boundary_conds.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !  
 ! Former revisions:
@@ -67,40 +72,4 @@
 ! 875 2012-04-02 15:35:15Z gryschka
 ! Bugfix in case of dirichlet inflow bc at the right or north boundary
-!
-! 767 2011-10-14 06:39:12Z raasch
-! ug,vg replaced by u_init,v_init as the Dirichlet top boundary condition
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-! Removed mirror boundary conditions for u and v at the bottom in case of 
-! ibc_uv_b == 0. Instead, dirichelt boundary conditions (u=v=0) are set
-! in init_3d_model 
-!
-! 107 2007-08-17 13:54:45Z raasch
-! Boundary conditions for temperature adjusted for coupled runs,
-! bugfixes for the radiation boundary conditions at the outflow: radiation
-! conditions are used for every substep, phase speeds are calculated for the
-! first Runge-Kutta substep only and then reused, several index values changed
-!
-! 95 2007-06-02 16:48:38Z raasch
-! Boundary conditions for salinity added
-!
-! 75 2007-03-22 09:54:05Z raasch
-! The "main" part sets conditions for time level t+dt instead of level t,
-! outflow boundary conditions changed from Neumann to radiation condition,
-! uxrp, vynp eliminated, moisture renamed humidity
-!
-! 19 2007-02-23 04:53:48Z raasch
-! Boundary conditions for e(nzt), pt(nzt), and q(nzt) removed because these
-! gridpoints are now calculated by the prognostic equation,
-! Dirichlet and zero gradient condition for pt established at top boundary
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.15  2006/02/23 09:54:55  raasch
-! Surface boundary conditions in case of topography: nzb replaced by
-! 2d-k-index-arrays (nzb_w_inner, etc.). Conditions for u and v remain
-! unchanged (still using nzb) because a non-flat topography must use a
-! Prandtl-layer, which don't requires explicit setting of the surface values.
 !
 ! Revision 1.1  1997/09/12 06:21:34  raasch
@@ -117,15 +86,40 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  c_u, c_u_m, c_u_m_l, c_v, c_v_m, c_v_m_l, c_w, c_w_m, c_w_m_l,  &
+               dzu, e_p, nr_p, pt, pt_p, q, q_p, qr_p, sa, sa_p,               &
+               u, ug, u_init, u_m_l, u_m_n, u_m_r, u_m_s, u_p,                 &
+               v, vg, v_init, v_m_l, v_m_n, v_m_r, v_m_s, v_p,                 &
+               w, w_p, w_m_l, w_m_n, w_m_r, w_m_s
+
+    USE control_parameters,                                                    &
+        ONLY:  bc_pt_t_val, bc_q_t_val, constant_diffusion,                    &
+               cloud_physics, dt_3d, humidity,                                 &
+               ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_sa_t, ibc_uv_b, ibc_uv_t,      &
+               icloud_scheme, inflow_l, inflow_n, inflow_r, inflow_s,          &
+               intermediate_timestep_count, large_scale_forcing, ocean,        &
+               outflow_l, outflow_n, outflow_r, outflow_s, passive_scalar,     &
+               precipitation, tsc, use_cmax
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx, ddy, dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg,             &
+               nzb, nzb_s_inner, nzb_w_inner, nzt
+
+    USE kinds
+
     USE pegrid
 
+
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k
-
-    REAL    ::  c_max, denom
+    INTEGER(iwp) ::  i !:
+    INTEGER(iwp) ::  j !:
+    INTEGER(iwp) ::  k !:
+
+    REAL(wp)    ::  c_max !:
+    REAL(wp)    ::  denom !:
 
 
@@ -271,5 +265,5 @@
        q_p(nzt+1,:,:) = q_p(nzt,:,:)   + bc_q_t_val * dzu(nzt+1)
 
-       IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
+       IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.                    &
             precipitation )  THEN
 !             
@@ -312,5 +306,5 @@
           IF ( humidity  .OR.  passive_scalar )  THEN
              q_p(:,nys-1,:) = q_p(:,nys,:)
-             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
+             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.              &
                   precipitation)  THEN
                 qr_p(:,nys-1,:) = qr_p(:,nys,:)
@@ -323,5 +317,5 @@
           IF ( humidity  .OR.  passive_scalar )  THEN
              q_p(:,nyn+1,:) = q_p(:,nyn,:)
-             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
+             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.              &
                   precipitation )  THEN
                 qr_p(:,nyn+1,:) = qr_p(:,nyn,:)
@@ -334,5 +328,5 @@
           IF ( humidity  .OR.  passive_scalar )  THEN
              q_p(:,:,nxl-1) = q_p(:,:,nxl)
-             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.  &
+             IF ( cloud_physics  .AND.  icloud_scheme == 0  .AND.              &
                   precipitation )  THEN
                 qr_p(:,:,nxl-1) = qr_p(:,:,nxl)
Index: /palm/trunk/SOURCE/buoyancy.f90
===================================================================
--- /palm/trunk/SOURCE/buoyancy.f90	(revision 1319)
+++ /palm/trunk/SOURCE/buoyancy.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Currrent revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -55,35 +60,4 @@
 ! 1010 2012-09-20 07:59:54Z raasch
 ! cpp switch __nopointer added for pointer free version
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 515 2010-03-18 02:30:38Z raasch
-! PGI-compiler creates SIGFPE in routine buoyancy, if opt>1 is used! Therefore,
-! opt=1 is forced by compiler-directive.
-!
-! 247 2009-02-27 14:01:30Z heinze
-! Output of messages replaced by message handling routine
-!
-! 132 2007-11-20 09:46:11Z letzel
-! Vertical scalar profiles now based on nzb_s_inner and ngp_2dh_s_inner.
-!
-! 106 2007-08-16 14:30:26Z raasch
-! i loop for u-component (sloping surface) is starting from nxlu (needed for
-! non-cyclic boundary conditions)
-! 
-! 97 2007-06-21 08:23:15Z raasch
-! Routine reneralized to be used with temperature AND density:
-! argument theta renamed var, new argument var_reference,
-! use_pt_reference renamed use_reference,
-! calc_mean_pt_profile renamed calc_mean_profile
-!
-! 57 2007-03-09 12:05:41Z raasch
-! Reference temperature pt_reference can be used.
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.19  2006/04/26 12:09:56  raasch
-! OpenMP optimization (one dimension added to sums_l)
 !
 ! Revision 1.1  1997/08/29 08:56:48  raasch
@@ -121,16 +95,30 @@
     SUBROUTINE buoyancy( var, wind_component )
 
-       USE arrays_3d
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  pt, pt_slope_ref, ref_state, tend
+
+       USE control_parameters,                                                 &
+           ONLY:  atmos_ocean_sign, cos_alpha_surface, g, message_string,      &
+                  pt_surface, sin_alpha_surface, sloping_surface
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxlu, nxr, nyn, nys, nzb_s_inner, nzt
+
+       USE kinds
+
        USE pegrid
 
+
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, wind_component
+       INTEGER(iwp) ::  i              !:
+       INTEGER(iwp) ::  j              !:
+       INTEGER(iwp) ::  k              !:
+       INTEGER(iwp) ::  wind_component !:
+       
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  var
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  var
 #endif
 
@@ -185,5 +173,5 @@
           ELSE
              
-             WRITE( message_string, * ) 'no term for component "',&
+             WRITE( message_string, * ) 'no term for component "',             &
                                        wind_component,'"'
              CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
@@ -201,16 +189,31 @@
     SUBROUTINE buoyancy_acc( var, wind_component )
 
-       USE arrays_3d
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  pt, pt_slope_ref, ref_state, tend
+
+       USE control_parameters,                                                 &
+           ONLY:  atmos_ocean_sign, cos_alpha_surface, g, message_string,      &
+                  pt_surface, sin_alpha_surface, sloping_surface
+
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nxl, nxlu, nxr, nyn, nys, &
+                  nzb_s_inner, nzt
+
+       USE kinds
+
        USE pegrid
 
+
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, wind_component
+       INTEGER(iwp) ::  i              !:
+       INTEGER(iwp) ::  j              !:
+       INTEGER(iwp) ::  k              !:
+       INTEGER(iwp) ::  wind_component !:
+       
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  var
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  var
 #endif
 
@@ -269,5 +272,5 @@
           ELSE
 
-             WRITE( message_string, * ) 'no term for component "',&
+             WRITE( message_string, * ) 'no term for component "',             &
                                        wind_component,'"'
              CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
@@ -288,16 +291,31 @@
     SUBROUTINE buoyancy_ij( i, j, var, wind_component )
 
-       USE arrays_3d
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  pt, pt_slope_ref, ref_state, tend
+
+       USE control_parameters,                                                 &
+           ONLY:  atmos_ocean_sign, cos_alpha_surface, g, message_string,      &
+                  pt_surface, sin_alpha_surface, sloping_surface
+
+       USE indices,                                                            &
+           ONLY:  nzb_s_inner, nzt
+
+       USE kinds
+
        USE pegrid
 
+
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, pr, wind_component
+       INTEGER(iwp) ::  i              !:
+       INTEGER(iwp) ::  j              !:
+       INTEGER(iwp) ::  k              !:
+       INTEGER(iwp) ::  pr             !:
+       INTEGER(iwp) ::  wind_component !:
+       
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  var
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  var
 #endif
 
@@ -307,7 +325,7 @@
 !--       Normal case: horizontal surface
           DO  k = nzb_s_inner(j,i)+1, nzt-1
-              tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5 * (     &
-                        ( 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 * (       &
+                        ( var(k,j,i)   - ref_state(k)   ) / ref_state(k)   +   &
+                        ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1)     &
                                                                        )
           ENDDO
@@ -340,5 +358,5 @@
           ELSE
 
-             WRITE( message_string, * ) 'no term for component "',&
+             WRITE( message_string, * ) 'no term for component "',             &
                                        wind_component,'"'
              CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
@@ -361,18 +379,36 @@
 !------------------------------------------------------------------------------!
 
-       USE arrays_3d,  ONLY: ref_state
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ref_state
+
+       USE control_parameters,                                                 &
+           ONLY:  intermediate_timestep_count, message_string
+
+       USE indices,                                                            &
+           ONLY:  ngp_2dh_s_inner, nxl, nxr, nyn, nys, nzb, nzb_s_inner, nzt
+
+       USE kinds
+
        USE pegrid
-       USE statistics
+
+       USE statistics,                                                         &
+           ONLY:  flow_statistics_called, hom, sums, sums_l
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, omp_get_thread_num, pr, tn
-       CHARACTER (LEN=*) ::  loc
+       CHARACTER (LEN=*) ::  loc !:
+       
+       INTEGER(iwp) ::  i                  !:
+       INTEGER(iwp) ::  j                  !:
+       INTEGER(iwp) ::  k                  !:
+       INTEGER(iwp) ::  pr                 !: 
+       INTEGER(iwp) ::  omp_get_thread_num !:
+       INTEGER(iwp) ::  tn                 !:
+       
 #if defined( __nopointer )
-       REAL, DIMENSION(:,:,:) ::  var
+       REAL(wp), DIMENSION(:,:,:) ::  var  !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  var
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  var
 #endif
 
@@ -383,5 +419,5 @@
 !--    spare communication time and to produce identical model results with jobs
 !--    which are calling flow_statistics at different time intervals.
-       IF ( .NOT. flow_statistics_called  .AND. &
+       IF ( .NOT. flow_statistics_called  .AND.                                &
             intermediate_timestep_count == 1 )  THEN
 
@@ -409,5 +445,5 @@
 
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,pr,0), sums(nzb,pr), nzt+2-nzb, &
+          CALL MPI_ALLREDUCE( sums_l(nzb,pr,0), sums(nzb,pr), nzt+2-nzb,       &
                               MPI_REAL, MPI_SUM, comm2d, ierr )
 
Index: /palm/trunk/SOURCE/calc_liquid_water_content.f90
===================================================================
--- /palm/trunk/SOURCE/calc_liquid_water_content.f90	(revision 1319)
+++ /palm/trunk/SOURCE/calc_liquid_water_content.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -38,20 +43,4 @@
 ! code put under GPL (PALM 3.9)
 !
-! 667 2010-12-23 12:06:00Z suehring/gyschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 95 2007-06-02 16:48:38Z raasch
-! hydro_press renamed hyp
-!
-! 19 2007-02-23 04:53:48Z raasch
-! Old comment removed
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.5  2005/03/26 15:22:06  raasch
-! Arguments for non-cyclic boundary conditions added to argument list of
-! routine exchange_horiz,
-! ql calculated for the ghost points, exchange of ghost points removed
-!
 ! Revision 1.1  2000/04/13 14:50:45  schroeter
 ! Initial revision
@@ -67,17 +56,31 @@
 
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE constants
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  hyp, pt, q, qc, ql, qr
+
+    USE cloud_parameters,                                                      &
+        ONLY:  l_d_cp, l_d_r, t_d_pt
+
+    USE control_parameters,                                                    &
+        ONLY:  icloud_scheme, precipitation
+
+    USE indices,                                                               &
+        ONLY:  nxlg, nxrg, nyng, nysg, nzb_s_inner, nzt
+
+    USE kinds
+
     USE pegrid
+
 
     IMPLICIT NONE
 
-    INTEGER :: i, j, k
+    INTEGER(iwp) ::  i !:
+    INTEGER(iwp) ::  j !:
+    INTEGER(iwp) ::  k !:
 
-    REAL :: alpha, e_s, q_s, t_l
+    REAL(wp) ::  alpha !:
+    REAL(wp) ::  e_s   !:
+    REAL(wp) ::  q_s   !:
+    REAL(wp) ::  t_l   !:
 
     DO  i = nxlg, nxrg
@@ -91,5 +94,5 @@
 !
 !--          Compute saturation water vapor pressure at t_l
-             e_s = 610.78 * EXP( 17.269 * ( t_l - 273.16 ) / &
+             e_s = 610.78 * EXP( 17.269 * ( t_l - 273.16 ) /                   &
                                           ( t_l - 35.86 ) )
 
Index: /palm/trunk/SOURCE/calc_precipitation.f90
===================================================================
--- /palm/trunk/SOURCE/calc_precipitation.f90	(revision 1319)
+++ /palm/trunk/SOURCE/calc_precipitation.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,19 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 403 2009-10-22 13:57:16Z franke
-! Bugfix in calculation of precipitation_rate(j,i)
-!
-! 73 2007-03-20 08:33:14Z raasch
-! Precipitation rate and amount are calculated/stored,
-! + module control_parameters
-!
-! 19 2007-02-23 04:53:48Z raasch
-! Calculation extended for gridpoint nzt
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.5  2004/01/30 10:15:57  raasch
-! Scalar lower k index nzb replaced by 2d-array nzb_2d
 !
 ! Revision 1.1  2000/04/13 14:45:22  schroeter
@@ -71,14 +61,29 @@
     SUBROUTINE calc_precipitation
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE constants
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  dzw, ql, tend
+
+       USE cloud_parameters,                                                   &
+           ONLY:  precipitation_amount, precipitation_rate, prec_time_const,   &
+                  ql_crit
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_do2d_xy, dt_3d,                                           &
+                  intermediate_timestep_count, intermediate_timestep_count_max,&
+                  precipitation_amount_interval, time_do2d_xy
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb_2d, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  dqdt_precip
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+       
+       REAL(wp)    ::  dqdt_precip !:
 
        precipitation_rate = 0.0
@@ -96,5 +101,5 @@
 !
 !--             Precipitation rate in kg / m**2 / s (= mm/s)
-                precipitation_rate(j,i) = precipitation_rate(j,i) + &
+                precipitation_rate(j,i) = precipitation_rate(j,i) +            &
                                           dqdt_precip * dzw(k)
 
@@ -102,9 +107,9 @@
 !
 !--          Sum up the precipitation amount, unit kg / m**2 (= mm)
-             IF ( intermediate_timestep_count ==         &
-                  intermediate_timestep_count_max  .AND. &
+             IF ( intermediate_timestep_count ==                               &
+                  intermediate_timestep_count_max  .AND.                       &
                   ( dt_do2d_xy-time_do2d_xy ) < precipitation_amount_interval )&
              THEN
-                precipitation_amount(j,i) = precipitation_amount(j,i) + &
+                precipitation_amount(j,i) = precipitation_amount(j,i) +        &
                                             precipitation_rate(j,i) * dt_3d
              ENDIF
@@ -120,14 +125,29 @@
     SUBROUTINE calc_precipitation_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE constants
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  dzw, ql, tend
+
+       USE cloud_parameters,                                                   &
+           ONLY:  precipitation_amount, precipitation_rate, prec_time_const,   &
+                  ql_crit
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_do2d_xy, dt_3d,                                           &
+                  intermediate_timestep_count, intermediate_timestep_count_max,&
+                  precipitation_amount_interval, time_do2d_xy
+
+       USE indices,                                                            &
+           ONLY:  nzb_2d, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  dqdt_precip
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
+       
+       REAL(wp)    ::  dqdt_precip !:       
 
        precipitation_rate(j,i) = 0.0
@@ -147,5 +167,5 @@
 !
 !--       Precipitation rate in kg / m**2 / s (= mm/s)
-          precipitation_rate(j,i) = precipitation_rate(j,i) + dqdt_precip * &
+          precipitation_rate(j,i) = precipitation_rate(j,i) + dqdt_precip *    &
                                                               dzw(k)
 
@@ -157,5 +177,5 @@
             .AND. ( dt_do2d_xy-time_do2d_xy ) < precipitation_amount_interval )&
        THEN
-          precipitation_amount(j,i) = precipitation_amount(j,i) + &
+          precipitation_amount(j,i) = precipitation_amount(j,i) +              &
                                       precipitation_rate(j,i) * dt_3d
        ENDIF
Index: /palm/trunk/SOURCE/calc_radiation.f90
===================================================================
--- /palm/trunk/SOURCE/calc_radiation.f90	(revision 1319)
+++ /palm/trunk/SOURCE/calc_radiation.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,9 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.6  2004/01/30 10:17:03  raasch
-! Scalar lower k index nzb replaced by 2d-array nzb_2d
 !
 ! Revision 1.1  2000/04/13 14:42:45  schroeter
@@ -43,13 +43,15 @@
 ! based on the parameterization of the cloud effective emissivity
 !------------------------------------------------------------------------------!
-
+    USE kinds
+    
     PRIVATE
     PUBLIC calc_radiation
     
-    LOGICAL, SAVE ::  first_call = .TRUE.
-    REAL, SAVE    ::  sigma = 5.67E-08
-
-    REAL, DIMENSION(:), ALLOCATABLE, SAVE ::  lwp_ground, lwp_top, &
-                                              blackbody_emission
+    LOGICAL, SAVE ::  first_call = .TRUE. !:
+    REAL(wp), SAVE ::  sigma = 5.67E-08   !:
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  lwp_ground         !:
+    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  lwp_top            !:
+    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  blackbody_emission !:
 
     INTERFACE calc_radiation
@@ -66,18 +68,40 @@
     SUBROUTINE calc_radiation
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  dzw, pt, ql, tend
+
+       USE cloud_parameters,                                                   &
+           ONLY:  cp, l_d_cp, pt_d_t, t_d_pt
+
+       USE control_parameters,                                                 &
+           ONLY:  rho_surface
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb, nzb_2d, nzt
+
+       USE kinds
+
        USE pegrid
 
+
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, k_help
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_help !:
  
-       REAL :: df_p, df_m , effective_emission_up_m, effective_emission_up_p, &
-               effective_emission_down_m, effective_emission_down_p,          &
-               f_up_m, f_up_p, f_down_m, f_down_p, impinging_flux_at_top,     &
-               temperature
+       REAL(wp) :: df_p                      !:
+       REAL(wp) :: df_m                      !:
+       REAL(wp) :: effective_emission_up_m   !:
+       REAL(wp) :: effective_emission_up_p   !:
+       REAL(wp) :: effective_emission_down_m !:
+       REAL(wp) :: effective_emission_down_p !:
+       REAL(wp) :: f_up_m                    !:
+       REAL(wp) :: f_up_p                    !:
+       REAL(wp) :: f_down_m                  !:
+       REAL(wp) :: f_down_p                  !:
+       REAL(wp) :: impinging_flux_at_top     !:
+       REAL(wp) :: temperature               !:
 
 
@@ -85,5 +109,5 @@
 !--    On first call, allocate temporary arrays
        IF ( first_call )  THEN
-          ALLOCATE( blackbody_emission(nzb:nzt+1), lwp_ground(nzb:nzt+1), &
+          ALLOCATE( blackbody_emission(nzb:nzt+1), lwp_ground(nzb:nzt+1),      &
                     lwp_top(nzb:nzt+1) )
           first_call = .FALSE.
@@ -105,8 +129,8 @@
 
                 k_help = ( nzt+nzb+1 ) - k
-                lwp_ground(k)   = lwp_ground(k-1) + rho_surface * ql(k,j,i) * &
+                lwp_ground(k)   = lwp_ground(k-1) + rho_surface * ql(k,j,i) *  &
                                   dzw(k)
 
-                lwp_top(k_help) = lwp_top(k_help+1) + &
+                lwp_top(k_help) = lwp_top(k_help+1) +                          &
                                   rho_surface * ql(k_help,j,i) * dzw(k_help)
 
@@ -116,9 +140,9 @@
              ENDDO
 
-             lwp_ground(nzt+1) = lwp_ground(nzt) + &
+             lwp_ground(nzt+1) = lwp_ground(nzt) +                             &
                                  rho_surface * ql(nzt+1,j,i) * dzw(nzt+1)
              lwp_top(nzb)      = lwp_top(nzb+1)
 
-             temperature       = pt(nzt+1,j,i) * t_d_pt(nzt+1) + l_d_cp * &
+             temperature       = pt(nzt+1,j,i) * t_d_pt(nzt+1) + l_d_cp *      &
                                  ql(nzt+1,j,i)
              blackbody_emission(nzt+1) = sigma * temperature**4.0
@@ -135,29 +159,29 @@
 !
 !--                Compute effective emissivities
-                   effective_emission_up_p   = 1.0 - &
+                   effective_emission_up_p   = 1.0 -                           &
                                                EXP( -130.0 * lwp_ground(k+1) )
-                   effective_emission_up_m   = 1.0 - &
+                   effective_emission_up_m   = 1.0 -                           &
                                                EXP( -130.0 * lwp_ground(k-1) )
-                   effective_emission_down_p = 1.0 - &
+                   effective_emission_down_p = 1.0 -                           &
                                                EXP( -158.0 * lwp_top(k+1) )
-                   effective_emission_down_m = 1.0 - &
+                   effective_emission_down_m = 1.0 -                           &
                                                EXP( -158.0 * lwp_top(k-1) )  
 
 !
 !--                Compute vertical long wave radiation fluxes
-                   f_up_p = blackbody_emission(nzb) + &
-                            effective_emission_up_p * &
+                   f_up_p = blackbody_emission(nzb) +                          &
+                            effective_emission_up_p *                          &
                            ( blackbody_emission(k) - blackbody_emission(nzb) )
 
-                   f_up_m = blackbody_emission(nzb) + &
-                            effective_emission_up_m * &
+                   f_up_m = blackbody_emission(nzb) +                          &
+                            effective_emission_up_m *                          &
                            ( blackbody_emission(k-1) - blackbody_emission(nzb) )
 
-                   f_down_p = impinging_flux_at_top + &
-                              effective_emission_down_p * &
+                   f_down_p = impinging_flux_at_top +                          &
+                              effective_emission_down_p *                      &
                              ( blackbody_emission(k) - impinging_flux_at_top )
 
-                   f_down_m = impinging_flux_at_top + &
-                              effective_emission_down_m * &
+                   f_down_m = impinging_flux_at_top +                          &
+                              effective_emission_down_m *                      &
                              ( blackbody_emission(k-1) - impinging_flux_at_top )
 
@@ -169,6 +193,6 @@
 !
 !--                Compute tendency term         
-                   tend(k,j,i) = tend(k,j,i) - &
-                                ( pt_d_t(k) / ( rho_surface * cp ) * &
+                   tend(k,j,i) = tend(k,j,i) -                                 &
+                                ( pt_d_t(k) / ( rho_surface * cp ) *           &
                                   ( df_p - df_m ) / dzw(k) )
 
@@ -187,23 +211,46 @@
     SUBROUTINE calc_radiation_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  dzw, pt, ql, tend
+
+       USE cloud_parameters,                                                   &
+           ONLY:  cp, l_d_cp, pt_d_t, t_d_pt
+
+       USE control_parameters,                                                 &
+           ONLY:  rho_surface
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_2d, nzt
+
+       USE kinds
+
        USE pegrid
+
    
        IMPLICIT NONE
 
-       INTEGER :: i, j, k, k_help
-
-       REAL :: df_p, df_m , effective_emission_up_m, effective_emission_up_p, &
-               effective_emission_down_m, effective_emission_down_p,          &
-               f_up_m, f_up_p, f_down_m, f_down_p, impinging_flux_at_top,     &
-               temperature
-
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  k      !:
+       INTEGER(iwp) ::  k_help !:
+
+       REAL(wp) :: df_p                      !:
+       REAL(wp) :: df_m                      !:
+       REAL(wp) :: effective_emission_up_m   !:
+       REAL(wp) :: effective_emission_up_p   !:
+       REAL(wp) :: effective_emission_down_m !:
+       REAL(wp) :: effective_emission_down_p !:
+       REAL(wp) :: f_up_m                    !:
+       REAL(wp) :: f_up_p                    !:
+       REAL(wp) :: f_down_m                  !:
+       REAL(wp) :: f_down_p                  !:
+       REAL(wp) :: impinging_flux_at_top     !:
+       REAL(wp) :: temperature               !:
+
+       
 !
 !--    On first call, allocate temporary arrays
        IF ( first_call )  THEN
-          ALLOCATE( blackbody_emission(nzb:nzt+1), lwp_ground(nzb:nzt+1), &
+          ALLOCATE( blackbody_emission(nzb:nzt+1), lwp_ground(nzb:nzt+1),      &
                     lwp_top(nzb:nzt+1) )
           first_call = .FALSE.
@@ -223,5 +270,5 @@
           lwp_ground(k)   = lwp_ground(k-1) + rho_surface * ql(k,j,i) * dzw(k)
 
-          lwp_top(k_help) = lwp_top(k_help+1) + &
+          lwp_top(k_help) = lwp_top(k_help+1) +                                &
                             rho_surface * ql(k_help,j,i) * dzw(k_help)
 
@@ -230,9 +277,9 @@
 
        ENDDO
-       lwp_ground(nzt+1) = lwp_ground(nzt) + &
+       lwp_ground(nzt+1) = lwp_ground(nzt) +                                   &
                            rho_surface * ql(nzt+1,j,i) * dzw(nzt+1)
        lwp_top(nzb)      = lwp_top(nzb+1)
 
-       temperature       = pt(nzt+1,j,i) * t_d_pt(nzt+1) + l_d_cp * &
+       temperature       = pt(nzt+1,j,i) * t_d_pt(nzt+1) + l_d_cp *            &
                            ql(nzt+1,j,i)
        blackbody_emission(nzt+1) = sigma * temperature**4.0
@@ -249,25 +296,25 @@
 !
 !--          Compute effective emissivities
-             effective_emission_up_p   = 1.0 - &
+             effective_emission_up_p   = 1.0 -                                 &
                                          EXP( -130.0 * lwp_ground(k+1) )
-             effective_emission_up_m   = 1.0 - &
+             effective_emission_up_m   = 1.0 -                                 &
                                          EXP( -130.0 * lwp_ground(k-1) )
-             effective_emission_down_p = 1.0 - &
+             effective_emission_down_p = 1.0 -                                 &
                                          EXP( -158.0 * lwp_top(k+1) )
-             effective_emission_down_m = 1.0 - &
+             effective_emission_down_m = 1.0 -                                 &
                                          EXP( -158.0 * lwp_top(k-1) )  
              
 !
 !--          Compute vertical long wave radiation fluxes
-             f_up_p = blackbody_emission(nzb) + effective_emission_up_p * &
+             f_up_p = blackbody_emission(nzb) + effective_emission_up_p *      &
                      ( blackbody_emission(k) - blackbody_emission(nzb) )
 
-             f_up_m = blackbody_emission(nzb) + effective_emission_up_m * &
+             f_up_m = blackbody_emission(nzb) + effective_emission_up_m *      &
                      ( blackbody_emission(k-1) - blackbody_emission(nzb) )
 
-             f_down_p = impinging_flux_at_top + effective_emission_down_p * &
+             f_down_p = impinging_flux_at_top + effective_emission_down_p *    &
                        ( blackbody_emission(k) - impinging_flux_at_top )
 
-             f_down_m = impinging_flux_at_top + effective_emission_down_m * &
+             f_down_m = impinging_flux_at_top + effective_emission_down_m *    &
                        ( blackbody_emission(k-1) - impinging_flux_at_top )
 
@@ -279,5 +326,5 @@
 !
 !--          Compute tendency term         
-             tend(k,j,i) = tend(k,j,i) - ( pt_d_t(k) / ( rho_surface * cp ) * &
+             tend(k,j,i) = tend(k,j,i) - ( pt_d_t(k) / ( rho_surface * cp ) *  &
                                          ( df_p - df_m ) / dzw(k) )
 
Index: /palm/trunk/SOURCE/calc_spectra.f90
===================================================================
--- /palm/trunk/SOURCE/calc_spectra.f90	(revision 1319)
+++ /palm/trunk/SOURCE/calc_spectra.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -41,29 +46,4 @@
 ! 1003 2012-09-14 14:35:53Z raasch
 ! adjustment of array tend for cases with unequal subdomain sizes removed
-!
-! 707 2011-03-29 11:39:40Z raasch
-! bc_lr/ns replaced by bc_lr/ns_cyc
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng for allocation
-! of tend
-!
-! 274 2009-03-26 15:11:21Z heinze
-! Output of messages replaced by message handling routine
-!
-! 225 2009-01-26 14:44:20Z raasch
-! Bugfix: array d is reallocated in case that multigrid is used
-!
-! 192 2008-08-27 16:51:49Z letzel
-! bugfix in calc_spectra_x: exponent = 1.0 / ( ny + 1.0 )
-! allow 100 spectra levels instead of 10 for consistency with
-! define_netcdf_header
-! user-defined spectra, arguments removed from transpose routines
-!
-! February 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.9  2006/04/11 14:56:00  raasch
-! pl_spectra renamed data_output_sp
 !
 ! Revision 1.1  2001/01/05 15:08:07  raasch
@@ -81,15 +61,31 @@
 
 #if defined( __spectra )
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE fft_xy
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  d, tend
+
+    USE control_parameters,                                                    &
+        ONLY:  average_count_sp, bc_lr_cyc, bc_ns_cyc, message_string, psolver
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE fft_xy,                                                                &
+        ONLY:  fft_init
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt, nzt_x, nzt_yd
+
+    USE kinds
+
     USE pegrid
-    USE spectrum
+
+    USE spectrum,                                                              &
+        ONLY:  data_output_sp, spectra_direction
+
 
     IMPLICIT NONE
 
-    INTEGER ::  m, pr
+    INTEGER(iwp) ::  m  !:
+    INTEGER(iwp) ::  pr !:
 
 
@@ -163,5 +159,5 @@
           CALL calc_spectra_y( d, pr, m )
 #else
-          message_string = 'sorry, calculation of spectra in non parallel' // &
+          message_string = 'sorry, calculation of spectra in non parallel' //  &
                            'mode& is still not realized'
           CALL message( 'calc_spectra', 'PA0161', 1, 2, 0, 6, 0 )
@@ -189,13 +185,28 @@
  SUBROUTINE preprocess_spectra( m, pr )
 
-    USE arrays_3d
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  d, pt, q, u, v, w
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
+
+    USE kinds
+
     USE pegrid
-    USE spectrum
-    USE statistics
+
+    USE spectrum,                                                              &
+        ONLY:  data_output_sp
+
+    USE statistics,                                                            &
+        ONLY:  sums
+
 
     IMPLICIT NONE
 
-    INTEGER :: i, j, k, m, pr
+    INTEGER(iwp) :: i  !:
+    INTEGER(iwp) :: j  !:
+    INTEGER(iwp) :: k  !:
+    INTEGER(iwp) :: m  !:
+    INTEGER(iwp) :: pr !:
 
     SELECT CASE ( TRIM( data_output_sp(m) ) )
@@ -247,25 +258,52 @@
  SUBROUTINE calc_spectra_x( ddd, pr, m )
 
-    USE arrays_3d
-    USE constants
-    USE control_parameters
-    USE fft_xy
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  
+
+    USE control_parameters,                                                    &
+        ONLY:  fft_method
+
+    USE fft_xy,                                                                &
+        ONLY:  fft_x_1d
+
+    USE grid_variables,                                                        &
+        ONLY:  dx
+
+    USE indices,                                                               &
+        ONLY:  nx, ny, nyn_x, nys_x, nzb_x, nzt_x
+
+    USE kinds
+
     USE pegrid
-    USE spectrum
-    USE statistics
+
+    USE spectrum,                                                              &
+        ONLY:  comp_spectra_level, n_sp_x
+
+    USE statistics,                                                            &
+        ONLY:  spectrum_x
+
     USE transpose_indices
 
+
     IMPLICIT NONE
 
-    INTEGER                    ::  i, ishape(1), j, k, m, n, pr
-
-    REAL                       ::  fac, exponent
-    REAL, DIMENSION(0:nx)      ::  work
-    REAL, DIMENSION(0:nx/2)    ::  sums_spectra_l
-    REAL, DIMENSION(0:nx/2,100)::  sums_spectra
-
-    REAL, DIMENSION(0:nx,nys_x:nyn_x,nzb_x:nzt_x) ::  ddd
+    INTEGER(iwp) ::  i         !:
+    INTEGER(iwp) ::  ishape(1) !:
+    INTEGER(iwp) ::  j         !:
+    INTEGER(iwp) ::  k         !:
+    INTEGER(iwp) ::  m         !:
+    INTEGER(iwp) ::  n         !:
+    INTEGER(iwp) ::  pr        !:
+
+    REAL(wp) ::  fac      !:
+    REAL(wp) ::  exponent !:
+    
+    REAL(wp), DIMENSION(0:nx) ::  work !:
+    
+    REAL(wp), DIMENSION(0:nx/2) ::  sums_spectra_l !:
+    
+    REAL(wp), DIMENSION(0:nx/2,100) ::  sums_spectra !:
+    
+    REAL(wp), DIMENSION(0:nx,nys_x:nyn_x,nzb_x:nzt_x) ::  ddd !:
 
 !
@@ -320,5 +358,5 @@
 #if defined( __parallel )   
        CALL MPI_BARRIER( comm2d, ierr )  ! Necessary?
-       CALL MPI_REDUCE( sums_spectra_l(0), sums_spectra(0,n), nx/2+1, &
+       CALL MPI_REDUCE( sums_spectra_l(0), sums_spectra(0,n), nx/2+1,          &
                         MPI_REAL, MPI_PROD, 0, comm2d, ierr )
 #else
@@ -357,25 +395,52 @@
  SUBROUTINE calc_spectra_y( ddd, pr, m )
 
-    USE arrays_3d
-    USE constants
-    USE control_parameters
-    USE fft_xy
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  
+
+    USE control_parameters,                                                    &
+        ONLY:  fft_method
+
+    USE fft_xy,                                                                &
+        ONLY:  fft_y_1d
+
+    USE grid_variables,                                                        &
+        ONLY:  dy
+
+    USE indices,                                                               &
+        ONLY:  nx, ny, nxl_yd, nxr_yd, nzb_yd, nzt_yd
+
+    USE kinds
+
     USE pegrid
-    USE spectrum
-    USE statistics
+
+    USE spectrum,                                                              &
+        ONLY:  comp_spectra_level, n_sp_y
+
+    USE statistics,                                                            &
+        ONLY:  spectrum_y
+
     USE transpose_indices
 
+
     IMPLICIT NONE
 
-    INTEGER :: i, j, jshape(1), k, m, n, pr
-
-    REAL                       ::  fac, exponent
-    REAL, DIMENSION(0:ny)      ::  work
-    REAL, DIMENSION(0:ny/2)    ::  sums_spectra_l
-    REAL, DIMENSION(0:ny/2,100)::  sums_spectra
-
-    REAL, DIMENSION(0:ny,nxl_yd:nxr_yd,nzb_yd:nzt_yd) :: ddd
+    INTEGER(iwp) ::  i         !:
+    INTEGER(iwp) ::  j         !:
+    INTEGER(iwp) ::  jshape(1) !:
+    INTEGER(iwp) ::  k         !:
+    INTEGER(iwp) ::  m         !:
+    INTEGER(iwp) ::  n         !:
+    INTEGER(iwp) ::  pr        !:
+
+    REAL(wp) ::  fac      !:
+    REAL(wp) ::  exponent !:
+    
+    REAL(wp), DIMENSION(0:ny) ::  work !:
+    
+    REAL(wp), DIMENSION(0:ny/2) ::  sums_spectra_l !:
+    
+    REAL(wp), DIMENSION(0:ny/2,100) ::  sums_spectra !:
+    
+    REAL(wp), DIMENSION(0:ny,nxl_yd:nxr_yd,nzb_yd:nzt_yd) :: ddd !:
 
 
@@ -431,5 +496,5 @@
 #if defined( __parallel )   
        CALL MPI_BARRIER( comm2d, ierr )  ! Necessary?
-       CALL MPI_REDUCE( sums_spectra_l(0), sums_spectra(0,n), ny/2+1, &
+       CALL MPI_REDUCE( sums_spectra_l(0), sums_spectra(0,n), ny/2+1,          &
                         MPI_REAL, MPI_PROD, 0, comm2d, ierr )
 #else
Index: /palm/trunk/SOURCE/check_for_restart.f90
===================================================================
--- /palm/trunk/SOURCE/check_for_restart.f90	(revision 1319)
+++ /palm/trunk/SOURCE/check_for_restart.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -32,26 +37,4 @@
 ! minor reformatting
 !
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Exchange of terminate_coupled between ocean and atmosphere by PE0
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 291 2009-04-16 12:07:26Z raasch
-! Coupling with independent precursor runs.
-! Output of messages replaced by message handling routine
-!
-! 222 2009-01-12 16:04:16Z letzel
-! Implementation of an MPI-1 coupling: replaced myid with target_id
-! Bugfix for nonparallel execution
-!
-! 108 2007-08-24 15:10:38Z letzel
-! modifications to terminate coupled runs
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.11  2007/02/11 12:55:13  raasch
-! Informative output to the job protocol
-!
 ! Revision 1.1  1998/03/18 20:06:51  raasch
 ! Initial revision
@@ -64,12 +47,19 @@
 !------------------------------------------------------------------------------!
 
+    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
     USE pegrid
-    USE control_parameters
 
     IMPLICIT NONE
 
 
-    LOGICAL :: terminate_run_l
-    REAL ::  remaining_time
+    LOGICAL :: terminate_run_l  !:
+
+    REAL(wp) ::  remaining_time !:
 
 
@@ -81,5 +71,5 @@
 !-- If necessary set a flag to stop the model run
     terminate_run_l = .FALSE.
-    IF ( remaining_time <= termination_time_needed  .AND. &
+    IF ( remaining_time <= termination_time_needed  .AND.                      &
          write_binary(1:4) == 'true' )  THEN
 
@@ -92,5 +82,5 @@
 !-- one processor has reached the time limit.
     IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-    CALL MPI_ALLREDUCE( terminate_run_l, terminate_run, 1, MPI_LOGICAL, &
+    CALL MPI_ALLREDUCE( terminate_run_l, terminate_run, 1, MPI_LOGICAL,        &
                         MPI_LOR, comm2d, ierr )
 #else
@@ -101,7 +91,7 @@
 !-- 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',   &
+       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 )
@@ -113,5 +103,5 @@
 !-- 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. &
+    IF ( terminate_run .AND. TRIM( coupling_mode ) /= 'uncoupled'  .AND.       &
          terminate_coupled == 0  .AND.  terminate_coupled_remote == 0 )  THEN
 
@@ -125,5 +115,5 @@
                              comm_inter, status, ierr )
        ENDIF
-       CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, comm2d,  &
+       CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, comm2d,    &
                        ierr )
 #endif
@@ -132,5 +122,5 @@
 !
 !-- Set the stop flag also, if restart is forced by user
-    IF ( time_restart /= 9999999.9  .AND.  &
+    IF ( time_restart /= 9999999.9  .AND.                                      &
          time_restart < time_since_reference_point )  THEN
 
@@ -149,7 +139,7 @@
           ENDIF
 
-          WRITE( message_string, * ) 'run will be terminated due to user ', &
-                                  'settings of',                            &
-                                  '&restart_time / dt_restart',             &
+          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 )
@@ -160,5 +150,5 @@
 !--       informed of another termination reason (terminate_coupled > 0) before,
 !--       or vice versa (terminate_coupled_remote > 0).
-          IF ( coupling_mode /= 'uncoupled' .AND. terminate_coupled == 0  &
+          IF ( coupling_mode /= 'uncoupled' .AND. terminate_coupled == 0       &
                .AND.  terminate_coupled_remote == 0 )  THEN
 
@@ -176,5 +166,5 @@
                                    comm_inter, status, ierr )   
              ENDIF
-             CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0,  &
+             CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0,      &
                              comm2d, ierr )  
 #endif
Index: /palm/trunk/SOURCE/check_namelist_files.f90
===================================================================
--- /palm/trunk/SOURCE/check_namelist_files.f90	(revision 1319)
+++ /palm/trunk/SOURCE/check_namelist_files.f90	(revision 1320)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements
 !
 ! Former revisions:
@@ -51,6 +51,9 @@
 
 
+    USE control_parameters,                                                    &
+        ONLY:  check_restart, max_pr_user
+
     USE pegrid
-    USE control_parameters
+
 
     IMPLICIT NONE
Index: /palm/trunk/SOURCE/check_open.f90
===================================================================
--- /palm/trunk/SOURCE/check_open.f90	(revision 1319)
+++ /palm/trunk/SOURCE/check_open.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -52,53 +58,4 @@
 ! 807 2012-01-25 11:53:51Z maronga
 ! New cpp directive "__check" implemented which is used by check_namelist_files
-!
-! Bugfix concerning opening of 3D files in restart runs in case of netCDF4
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Output of total array size was adapted to nbgp.
-!
-! 600 2010-11-24 16:10:51Z raasch
-! bugfix in opening of cross section netcdf-files (parallel opening with
-! netcdf4 only works for netcdf_data_format > 2)
-!
-! 564 2010-09-30 13:18:59Z helmke
-! start number of mask output files changed to 201, netcdf message identifiers
-! of masked output changed
-!
-! 519 2010-03-19 05:30:02Z raasch
-! netCDF4 support for particle data
-!
-! 493 2010-03-01 08:30:24Z raasch
-! netCDF4 support (parallel output)
-!
-! 410 2009-12-04 17:05:40Z letzel
-! masked data output
-!
-! 277 2009-03-31 09:13:47Z heinze
-! Output of netCDF messages with aid of message handling routine.
-! Output of messages replaced by message handling routine
-!
-! 146 2008-01-17 13:08:34Z raasch
-! First opening of unit 13 openes file _0000 on all PEs (parallel version)
-! because only this file contains the global variables,
-! myid_char_14 removed
-!
-! 120 2007-10-17 11:54:43Z raasch
-! Status of 3D-volume netCDF data file only depends on switch netcdf_64bit_3d
-!
-! 105 2007-08-08 07:12:55Z raasch
-! Different filenames are used in case of a coupled simulation,
-! coupling_char added to all relevant filenames
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Call of local_getenv removed, preprocessor directives for old systems removed
-!
-! 46 2007-03-05 06:00:47Z raasch
-! +netcdf_64bit_3d to switch on 64bit offset only for 3D files
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.44  2006/08/22 13:48:34  raasch
-! xz and yz cross sections now up to nzt+1
 !
 ! Revision 1.1  1997/08/11 06:10:55  raasch
@@ -112,45 +69,97 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  zu
+
+    USE control_parameters,                                                    &
+        ONLY:  avs_data_file, avs_output, coupling_char,                       &
+               data_output_2d_on_each_pe, do3d_compress, host, iso2d_output,   &
+               message_string, mid, netcdf_data_format, nz_do3d, openfile,     &
+               return_addres, return_username, run_description_header, runnr
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nbgp, nx, nxlg, nxrg, ny, nyng, nysg, nz, nzb 
+
+    USE kinds
+
     USE netcdf_control
-    USE particle_attributes
+
+    USE particle_attributes,                                                   &
+        ONLY:  max_number_of_particle_groups, number_of_particle_groups,       &
+               particle_groups
+
     USE pegrid
-    USE precision_kind
-    USE profil_parameter
-    USE statistics
+
+    USE profil_parameter,                                                      &
+        ONLY:  cross_ts_numbers, cross_ts_number_count
+
+    USE statistics,                                                            &
+        ONLY:  region, statistic_regions
+
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=2)   ::  mask_char, suffix
-    CHARACTER (LEN=20)  ::  xtext = 'time in s'
-    CHARACTER (LEN=30)  ::  filename
-    CHARACTER (LEN=40)  ::  avs_coor_file, avs_coor_file_localname, &
-                            avs_data_file_localname
-    CHARACTER (LEN=80)  ::  rtext
-    CHARACTER (LEN=100) ::  avs_coor_file_catalog, avs_data_file_catalog, &
-                            batch_scp, zeile
-    CHARACTER (LEN=400) ::  command
-
-    INTEGER ::  av, anzzeile = 1, cranz, file_id, i, iaddres, iusern, &
-                j, k, legpos = 1, timodex = 1
-    INTEGER, DIMENSION(10) ::  klist
-
-    LOGICAL ::  avs_coor_file_found = .FALSE., avs_data_file_found = .FALSE., &
-                datleg = .TRUE., get_filenames, grid = .TRUE., netcdf_extend, &
-                rand = .TRUE., swap = .TRUE., twoxa = .TRUE., twoya = .TRUE.
-
-    REAL ::  ansx = -999.999, ansy = -999.999, gwid = 0.1, rlegfak = 1.5, &
-             sizex = 250.0, sizey = 40.0, texfac = 1.5
-
-    REAL, DIMENSION(:), ALLOCATABLE      ::  eta, ho, hu
-    REAL(spk), DIMENSION(:), ALLOCATABLE ::  xkoor, ykoor, zkoor  
-
-
-    NAMELIST /RAHMEN/  anzzeile, cranz, datleg, rtext, swap
-    NAMELIST /CROSS/   ansx, ansy, grid, gwid, klist, legpos, &
-                       rand, rlegfak, sizex, sizey, texfac, &
+    CHARACTER (LEN=2)   ::  mask_char               !:
+    CHARACTER (LEN=2)   ::  suffix                  !:
+    CHARACTER (LEN=20)  ::  xtext = 'time in s'     !:
+    CHARACTER (LEN=30)  ::  filename                !:
+    CHARACTER (LEN=40)  ::  avs_coor_file           !:
+    CHARACTER (LEN=40)  ::  avs_coor_file_localname !:
+    CHARACTER (LEN=40)  ::  avs_data_file_localname !:
+    CHARACTER (LEN=80)  ::  rtext                   !:
+    CHARACTER (LEN=100) ::  avs_coor_file_catalog   !:
+    CHARACTER (LEN=100) ::  avs_data_file_catalog   !:
+    CHARACTER (LEN=100) ::  batch_scp               !:
+    CHARACTER (LEN=100) ::  line                    !:
+    CHARACTER (LEN=400) ::  command                 !:
+
+    INTEGER(iwp) ::  av          !:
+    INTEGER(iwp) ::  numline = 1 !:
+    INTEGER(iwp) ::  cranz       !:
+    INTEGER(iwp) ::  file_id     !:
+    INTEGER(iwp) ::  i           !:
+    INTEGER(iwp) ::  iaddres     !:
+    INTEGER(iwp) ::  iusern      !:
+    INTEGER(iwp) ::  j           !:
+    INTEGER(iwp) ::  k           !:
+    INTEGER(iwp) ::  legpos = 1  !:
+    INTEGER(iwp) ::  timodex = 1 !:
+    
+    INTEGER(iwp), DIMENSION(10) ::  klist !:
+
+    LOGICAL ::  avs_coor_file_found = .FALSE. !:
+    LOGICAL ::  avs_data_file_found = .FALSE. !:
+    LOGICAL ::  datleg = .TRUE.               !:
+    LOGICAL ::  get_filenames                 !:
+    LOGICAL ::  grid = .TRUE.                 !:
+    LOGICAL ::  netcdf_extend                 !:
+    LOGICAL ::  rand = .TRUE.                 !:
+    LOGICAL ::  swap = .TRUE.                 !:
+    LOGICAL ::  twoxa = .TRUE.                !:
+    LOGICAL ::  twoya = .TRUE.                !:
+
+    REAL(wp) ::  ansx = -999.999 !:
+    REAL(wp) ::  ansy = -999.999 !:
+    REAL(wp) ::  gwid = 0.1      !:
+    REAL(wp) ::  rlegfak = 1.5   !:
+    REAL(wp) ::  sizex = 250.0   !:
+    REAL(wp) ::  sizey = 40.0    !:
+    REAL(wp) ::  texfac = 1.5    !:
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE      ::  eta !:
+    REAL(wp), DIMENSION(:), ALLOCATABLE      ::  ho  !:
+    REAL(wp), DIMENSION(:), ALLOCATABLE      ::  hu  !:
+    
+    REAL(sp), DIMENSION(:), ALLOCATABLE ::  xkoor !:
+    REAL(sp), DIMENSION(:), ALLOCATABLE ::  ykoor !:
+    REAL(sp), DIMENSION(:), ALLOCATABLE ::  zkoor !:  
+
+
+    NAMELIST /RAHMEN/  numline, cranz, datleg, rtext, swap
+    NAMELIST /CROSS/   ansx, ansy, grid, gwid, klist, legpos,                  &
+                       rand, rlegfak, sizex, sizey, texfac,                    &
                        timodex, twoxa, twoya, xtext
                        
@@ -169,5 +178,5 @@
           CASE ( 13, 14, 21, 22, 23, 80:85 )
              IF ( file_id == 14 .AND. openfile(file_id)%opened_before )  THEN
-                message_string = 're-open of unit ' // &
+                message_string = 're-open of unit ' //                         &
                                  '14 is not verified. Please check results!'
                 CALL message( 'check_open', 'PA0165', 0, 1, 0, 6, 0 )       
@@ -175,5 +184,5 @@
 
           CASE DEFAULT
-             WRITE( message_string, * ) 're-opening of file-id ', file_id, &
+             WRITE( message_string, * ) 're-opening of file-id ', file_id,     &
                                         ' is not allowed'
              CALL message( 'check_open', 'PA0166', 0, 1, 0, 6, 0 )    
@@ -192,5 +201,5 @@
 	      
           IF ( myid /= 0 )  THEN
-             WRITE( message_string, * ) 'opening file-id ',file_id, &
+             WRITE( message_string, * ) 'opening file-id ',file_id,            &
                                         ' not allowed for PE ',myid
              CALL message( 'check_open', 'PA0167', 2, 2, -1, 6, 1 )
@@ -202,5 +211,5 @@
           
              IF ( myid /= 0 )  THEN
-                WRITE( message_string, * ) 'opening file-id ',file_id, &
+                WRITE( message_string, * ) 'opening file-id ',file_id,         &
                                            ' not allowed for PE ',myid
                 CALL message( 'check_open', 'PA0167', 2, 2, -1, 6, 1 )
@@ -213,5 +222,5 @@
           IF ( .NOT.  data_output_2d_on_each_pe )  THEN
              IF ( myid /= 0 )  THEN
-                WRITE( message_string, * ) 'opening file-id ',file_id, &
+                WRITE( message_string, * ) 'opening file-id ',file_id,         &
                                            ' not allowed for PE ',myid
                 CALL message( 'check_open', 'PA0167', 2, 2, -1, 6, 1 )
@@ -223,5 +232,5 @@
 !
 !--       File-ids that are used temporarily in other routines
-          WRITE( message_string, * ) 'opening file-id ',file_id, &
+          WRITE( message_string, * ) 'opening file-id ',file_id,               &
                                     ' is not allowed since it is used otherwise'
           CALL message( 'check_open', 'PA0168', 0, 1, 0, 6, 0 ) 
@@ -241,13 +250,13 @@
 !--       check_namelist_files!
           IF ( check_restart == 2 ) THEN
-             OPEN ( 11, FILE='PARINF'//coupling_char, FORM='FORMATTED', &
+             OPEN ( 11, FILE='PARINF'//coupling_char, FORM='FORMATTED',        &
                         STATUS='OLD' )
           ELSE
-             OPEN ( 11, FILE='PARIN'//coupling_char, FORM='FORMATTED', &
+             OPEN ( 11, FILE='PARIN'//coupling_char, FORM='FORMATTED',         &
                         STATUS='OLD' )
           END IF
 #else
 
-          OPEN ( 11, FILE='PARIN'//coupling_char, FORM='FORMATTED', &
+          OPEN ( 11, FILE='PARIN'//coupling_char, FORM='FORMATTED',            &
                      STATUS='OLD' )
 #endif
@@ -256,5 +265,5 @@
 
           IF ( myid_char == '' )  THEN
-             OPEN ( 13, FILE='BININ'//coupling_char//myid_char, &
+             OPEN ( 13, FILE='BININ'//coupling_char//myid_char,                &
                         FORM='UNFORMATTED', STATUS='OLD' )
           ELSE
@@ -263,5 +272,5 @@
 !--          this file contains the global variables
              IF ( .NOT. openfile(file_id)%opened_before )  THEN
-                OPEN ( 13, FILE='BININ'//TRIM( coupling_char )//'/_0000',&
+                OPEN ( 13, FILE='BININ'//TRIM( coupling_char )//'/_0000',      &
                            FORM='UNFORMATTED', STATUS='OLD' )
              ELSE
@@ -274,5 +283,5 @@
 
           IF ( myid_char == '' )  THEN
-             OPEN ( 14, FILE='BINOUT'//coupling_char//myid_char, &
+             OPEN ( 14, FILE='BINOUT'//coupling_char//myid_char,               &
                         FORM='UNFORMATTED', POSITION='APPEND' )
           ELSE
@@ -286,5 +295,5 @@
              CALL MPI_BARRIER( comm2d, ierr )
 #endif
-             OPEN ( 14, FILE='BINOUT'//TRIM(coupling_char)//'/'//myid_char, &
+             OPEN ( 14, FILE='BINOUT'//TRIM(coupling_char)//'/'//myid_char,    &
                         FORM='UNFORMATTED' )
           ENDIF
@@ -316,5 +325,5 @@
           ENDIF
           IF ( myid_char == '' )  THEN
-             OPEN ( 20, FILE='DATA_LOG'//TRIM( coupling_char )//'/_0000', &
+             OPEN ( 20, FILE='DATA_LOG'//TRIM( coupling_char )//'/_0000',      &
                         FORM='UNFORMATTED', POSITION='APPEND' )
           ELSE
@@ -332,8 +341,8 @@
 
           IF ( data_output_2d_on_each_pe )  THEN
-             OPEN ( 21, FILE='PLOT2D_XY'//TRIM( coupling_char )//myid_char, &
+             OPEN ( 21, FILE='PLOT2D_XY'//TRIM( coupling_char )//myid_char,    &
                         FORM='UNFORMATTED', POSITION='APPEND' )
           ELSE
-             OPEN ( 21, FILE='PLOT2D_XY'//coupling_char, &
+             OPEN ( 21, FILE='PLOT2D_XY'//coupling_char,                       &
                         FORM='UNFORMATTED', POSITION='APPEND' )
           ENDIF
@@ -363,5 +372,5 @@
 !--          Create output file for local parameters
              IF ( iso2d_output )  THEN
-                OPEN ( 27, FILE='PLOT2D_XY_LOCAL'//coupling_char, &
+                OPEN ( 27, FILE='PLOT2D_XY_LOCAL'//coupling_char,              &
                            FORM='FORMATTED', DELIM='APOSTROPHE' )
                 openfile(27)%opened = .TRUE.
@@ -373,8 +382,8 @@
 
           IF ( data_output_2d_on_each_pe )  THEN
-             OPEN ( 22, FILE='PLOT2D_XZ'//TRIM( coupling_char )//myid_char, &
+             OPEN ( 22, FILE='PLOT2D_XZ'//TRIM( coupling_char )//myid_char,    &
                         FORM='UNFORMATTED', POSITION='APPEND' )
           ELSE
-             OPEN ( 22, FILE='PLOT2D_XZ'//coupling_char, FORM='UNFORMATTED', &
+             OPEN ( 22, FILE='PLOT2D_XZ'//coupling_char, FORM='UNFORMATTED',   &
                         POSITION='APPEND' )
           ENDIF
@@ -402,5 +411,5 @@
 !
 !--          Create output file for local parameters
-             OPEN ( 28, FILE='PLOT2D_XZ_LOCAL'//coupling_char, &
+             OPEN ( 28, FILE='PLOT2D_XZ_LOCAL'//coupling_char,                 &
                         FORM='FORMATTED', DELIM='APOSTROPHE' )
              openfile(28)%opened = .TRUE.
@@ -411,8 +420,8 @@
 
           IF ( data_output_2d_on_each_pe )  THEN
-             OPEN ( 23, FILE='PLOT2D_YZ'//TRIM( coupling_char )//myid_char, &
+             OPEN ( 23, FILE='PLOT2D_YZ'//TRIM( coupling_char )//myid_char,    &
                         FORM='UNFORMATTED', POSITION='APPEND' )
           ELSE
-             OPEN ( 23, FILE='PLOT2D_YZ'//coupling_char, FORM='UNFORMATTED', &
+             OPEN ( 23, FILE='PLOT2D_YZ'//coupling_char, FORM='UNFORMATTED',   &
                         POSITION='APPEND' )
           ENDIF
@@ -440,5 +449,5 @@
 !
 !--          Create output file for local parameters
-             OPEN ( 29, FILE='PLOT2D_YZ_LOCAL'//coupling_char, &
+             OPEN ( 29, FILE='PLOT2D_YZ_LOCAL'//coupling_char,                 &
                         FORM='FORMATTED', DELIM='APOSTROPHE' )
              openfile(29)%opened = .TRUE.
@@ -448,5 +457,5 @@
        CASE ( 30 )
 
-          OPEN ( 30, FILE='PLOT3D_DATA'//TRIM( coupling_char )//myid_char, &
+          OPEN ( 30, FILE='PLOT3D_DATA'//TRIM( coupling_char )//myid_char,     &
                      FORM='UNFORMATTED' )
 !
@@ -471,23 +480,23 @@
 
                 OPEN ( 3, FILE='OUTPUT_FILE_CONNECTIONS', FORM='FORMATTED' )
-                DO  WHILE ( .NOT. avs_coor_file_found  .OR. &
+                DO  WHILE ( .NOT. avs_coor_file_found  .OR.                    &
                             .NOT. avs_data_file_found )
 
-                   READ ( 3, '(A)', END=1 )  zeile
-
-                   SELECT CASE ( zeile(1:11) )
+                   READ ( 3, '(A)', END=1 )  line
+
+                   SELECT CASE ( line(1:11) )
 
                       CASE ( 'PLOT3D_COOR' )
-                         READ ( 3, '(A/A)' )  avs_coor_file_catalog, &
+                         READ ( 3, '(A/A)' )  avs_coor_file_catalog,           &
                                               avs_coor_file_localname
                          avs_coor_file_found = .TRUE.
 
                       CASE ( 'PLOT3D_DATA' )
-                         READ ( 3, '(A/A)' )  avs_data_file_catalog, &
+                         READ ( 3, '(A/A)' )  avs_data_file_catalog,           &
                                               avs_data_file_localname
                          avs_data_file_found = .TRUE.
 
                       CASE DEFAULT
-                         READ ( 3, '(A/A)' )  zeile, zeile
+                         READ ( 3, '(A/A)' )  line, line
 
                    END SELECT
@@ -498,8 +507,8 @@
 !--             using batch_scp
        1        CLOSE ( 3 )
-                IF ( .NOT. avs_coor_file_found  .OR. &
+                IF ( .NOT. avs_coor_file_found  .OR.                           &
                      .NOT. avs_data_file_found )  THEN
-                   message_string= 'no filename for AVS-data-file ' //       &
-                                   'found in MRUN-config-file' //            &
+                   message_string= 'no filename for AVS-data-file ' //         &
+                                   'found in MRUN-config-file' //              &
                                    ' &filename in FLD-file set to "unknown"'
                    CALL message( 'check_open', 'PA0169', 0, 1, 0, 6, 0 )
@@ -509,10 +518,10 @@
                 ELSE
                    get_filenames = .TRUE.
-                   IF ( TRIM( host ) == 'hpmuk'  .OR.  &
+                   IF ( TRIM( host ) == 'hpmuk'  .OR.                          &
                         TRIM( host ) == 'lcmuk' )  THEN
                       batch_scp = '/home/raasch/pub/batch_scp'
                    ELSEIF ( TRIM( host ) == 'nech' )  THEN
                       batch_scp = '/ipf/b/b323011/pub/batch_scp'
-                   ELSEIF ( TRIM( host ) == 'ibmh'  .OR.  &
+                   ELSEIF ( TRIM( host ) == 'ibmh'  .OR.                       &
                             TRIM( host ) == 'ibmb' )  THEN
                       batch_scp = '/home/h/niksiraa/pub/batch_scp'
@@ -520,5 +529,5 @@
                       batch_scp = '/home/nhbksira/pub/batch_scp'
                    ELSE
-                      message_string= 'no path for batch_scp on host "' // &
+                      message_string= 'no path for batch_scp on host "' //     &
                                        TRIM( host ) // '"'
                       CALL message( 'check_open', 'PA0170', 0, 1, 0, 6, 0 )
@@ -531,8 +540,8 @@
 !--                   /etc/passwd serves as Dummy-Datei, because it is not 
 !--                   really transferred.
-                      command = TRIM( batch_scp ) // ' -n -u ' // &
-                         return_username(1:iusern) // ' ' // &
-                         return_addres(1:iaddres) // ' /etc/passwd "' // &
-                         TRIM( avs_coor_file_catalog ) // '" ' // &
+                      command = TRIM( batch_scp ) // ' -n -u ' //              &
+                         return_username(1:iusern) // ' ' //                   &
+                         return_addres(1:iaddres) // ' /etc/passwd "' //       &
+                         TRIM( avs_coor_file_catalog ) // '" ' //              &
                          TRIM( avs_coor_file_localname ) // ' > REMOTE_FILENAME'
 
@@ -543,8 +552,8 @@
 !
 !--                   Determine the data file name
-                      command = TRIM( batch_scp ) // ' -n -u ' // &
-                         return_username(1:iusern) // ' ' // &
-                         return_addres(1:iaddres) // ' /etc/passwd "' // &
-                         TRIM( avs_data_file_catalog ) // '" ' // &
+                      command = TRIM( batch_scp ) // ' -n -u ' //              &
+                         return_username(1:iusern) // ' ' //                   &
+                         return_addres(1:iaddres) // ' /etc/passwd "' //       &
+                         TRIM( avs_data_file_catalog ) // '" ' //              &
                          TRIM( avs_data_file_localname ) // ' > REMOTE_FILENAME'
 
@@ -567,6 +576,6 @@
                 OPEN ( 33, FILE='PLOT3D_FLD_COOR', FORM='FORMATTED' )
                 openfile(33)%opened = .TRUE.
-                WRITE ( 33, 3300 )  TRIM( avs_coor_file ), &
-                                    TRIM( avs_coor_file ), (nx+2*nbgp)*4, &
+                WRITE ( 33, 3300 )  TRIM( avs_coor_file ),                     &
+                                    TRIM( avs_coor_file ), (nx+2*nbgp)*4,      &
                                     TRIM( avs_coor_file ), (nx+2*nbgp)*4+(ny+2*nbgp)*4
             
@@ -623,6 +632,6 @@
              WRITE ( suffix, '(''_'',I1)' )  file_id - 50
           ENDIF
-          OPEN ( file_id, FILE='PLOTTS_DATA'//TRIM( coupling_char )// &
-                               TRIM( suffix ),                        &
+          OPEN ( file_id, FILE='PLOTTS_DATA'//TRIM( coupling_char )//          &
+                               TRIM( suffix ),                                 &
                           FORM='FORMATTED', RECL=496 )
 !
@@ -638,10 +647,10 @@
              IF ( cross_ts_number_count(j) /= 0 )  cranz = cranz+1
           ENDDO
-          rtext = '\1.0 ' // TRIM( run_description_header ) // '    ' // &
+          rtext = '\1.0 ' // TRIM( run_description_header ) // '    ' //       &
                   TRIM( region( file_id - 50 ) )
 !
 !--       Write RAHMEN parameter
-          OPEN ( 90, FILE='PLOTTS_PAR'//TRIM( coupling_char )// &
-                           TRIM( suffix ),                      &
+          OPEN ( 90, FILE='PLOTTS_PAR'//TRIM( coupling_char )//                &
+                           TRIM( suffix ),                                     &
                      FORM='FORMATTED', DELIM='APOSTROPHE' )
           WRITE ( 90, RAHMEN )
@@ -669,5 +678,5 @@
 !--       series data to the bottom of that file.
           IF ( runnr == 0 )  THEN
-             WRITE ( file_id, 5000 )  TRIM( run_description_header ) // &
+             WRITE ( file_id, 5000 )  TRIM( run_description_header ) //        &
                                       '    ' // TRIM( region( file_id - 50 ) )
           ENDIF
@@ -694,6 +703,6 @@
              ENDIF
 #endif
-             OPEN ( 80, FILE='PARTICLE_INFOS'//TRIM( coupling_char )//'/'// &
-                             myid_char,                                     &
+             OPEN ( 80, FILE='PARTICLE_INFOS'//TRIM( coupling_char )//'/'//    &
+                             myid_char,                                        &
                         FORM='FORMATTED', POSITION='APPEND' )
           ENDIF
@@ -705,5 +714,5 @@
        CASE ( 81 )
 
-             OPEN ( 81, FILE='PLOTSP_X_PAR'//coupling_char, FORM='FORMATTED', &
+             OPEN ( 81, FILE='PLOTSP_X_PAR'//coupling_char, FORM='FORMATTED',  &
                         DELIM='APOSTROPHE', RECL=1500, POSITION='APPEND' )
 
@@ -715,5 +724,5 @@
        CASE ( 83 )
 
-             OPEN ( 83, FILE='PLOTSP_Y_PAR'//coupling_char, FORM='FORMATTED', &
+             OPEN ( 83, FILE='PLOTSP_Y_PAR'//coupling_char, FORM='FORMATTED',  &
                         DELIM='APOSTROPHE', RECL=1500, POSITION='APPEND' )
 
@@ -726,5 +735,5 @@
 
           IF ( myid_char == '' )  THEN
-             OPEN ( 85, FILE='PARTICLE_DATA'//TRIM(coupling_char)//myid_char, &
+             OPEN ( 85, FILE='PARTICLE_DATA'//TRIM(coupling_char)//myid_char,  &
                         FORM='UNFORMATTED', POSITION='APPEND' )
           ELSE
@@ -738,6 +747,6 @@
              CALL MPI_BARRIER( comm2d, ierr )
 #endif
-             OPEN ( 85, FILE='PARTICLE_DATA'//TRIM( coupling_char )//'/'// &
-                        myid_char,                                         &
+             OPEN ( 85, FILE='PARTICLE_DATA'//TRIM( coupling_char )//'/'//     &
+                        myid_char,                                             &
                         FORM='UNFORMATTED', POSITION='APPEND' )
           ENDIF
@@ -751,5 +760,5 @@
              rtext = 'data format version 3.0'
              WRITE ( 85 )  rtext
-             WRITE ( 85 )  number_of_particle_groups, &
+             WRITE ( 85 )  number_of_particle_groups,                          &
                            max_number_of_particle_groups
              WRITE ( 85 )  particle_groups
@@ -1110,5 +1119,5 @@
              filename = 'DATA_PRT_NETCDF' // coupling_char
           ELSE
-             filename = 'DATA_PRT_NETCDF' // TRIM( coupling_char ) // '/' // &
+             filename = 'DATA_PRT_NETCDF' // TRIM( coupling_char ) // '/' //   &
                         myid_char
           ENDIF
@@ -1143,7 +1152,7 @@
 !--          For runs on multiple processors create the subdirectory
              IF ( myid_char /= '' )  THEN
-                IF ( myid == 0  .AND. .NOT. openfile(file_id)%opened_before ) &
+                IF ( myid == 0  .AND. .NOT. openfile(file_id)%opened_before )  &
                 THEN    ! needs modification in case of non-extendable sets
-                   CALL local_system( 'mkdir  DATA_PRT_NETCDF' // &
+                   CALL local_system( 'mkdir  DATA_PRT_NETCDF' //              &
                                        TRIM( coupling_char ) // '/' )
                 ENDIF
@@ -1217,5 +1226,5 @@
              mid = file_id - (200+max_masks)
              WRITE ( mask_char,'(I2.2)')  mid
-             filename = 'DATA_MASK_' // mask_char // '_AV_NETCDF' // &
+             filename = 'DATA_MASK_' // mask_char // '_AV_NETCDF' //           &
                   coupling_char
              av = 1
@@ -1230,5 +1239,5 @@
 !
 !--          Open an existing netCDF file for output
-             CALL open_write_netcdf_file( filename, id_set_mask(mid,av), &
+             CALL open_write_netcdf_file( filename, id_set_mask(mid,av),       &
                                           .TRUE., 456 )
 !
@@ -1282,18 +1291,18 @@
 !
 !-- Formats
-3300 FORMAT ('#'/                                                   &
-             'coord 1  file=',A,'  filetype=unformatted'/           &
-             'coord 2  file=',A,'  filetype=unformatted  skip=',I6/ &
-             'coord 3  file=',A,'  filetype=unformatted  skip=',I6/ &
+3300 FORMAT ('#'/                                                              &
+             'coord 1  file=',A,'  filetype=unformatted'/                      &
+             'coord 2  file=',A,'  filetype=unformatted  skip=',I6/            &
+             'coord 3  file=',A,'  filetype=unformatted  skip=',I6/            &
              '#')
 4000 FORMAT ('# ',A)
-5000 FORMAT ('# ',A/                                                          &
-             '#1 E'/'#2 E*'/'#3 dt'/'#4 u*'/'#5 th*'/'#6 umax'/'#7 vmax'/     &
-             '#8 wmax'/'#9 div_new'/'#10 div_old'/'#11 z_i_wpt'/'#12 z_i_pt'/ &
-             '#13 w*'/'#14 w''pt''0'/'#15 w''pt'''/'#16 wpt'/'#17 pt(0)'/     &
+5000 FORMAT ('# ',A/                                                           &
+             '#1 E'/'#2 E*'/'#3 dt'/'#4 u*'/'#5 th*'/'#6 umax'/'#7 vmax'/      &
+             '#8 wmax'/'#9 div_new'/'#10 div_old'/'#11 z_i_wpt'/'#12 z_i_pt'/  &
+             '#13 w*'/'#14 w''pt''0'/'#15 w''pt'''/'#16 wpt'/'#17 pt(0)'/      &
              '#18 pt(zp)'/'#19 splptx'/'#20 splpty'/'#21 splptz')
-8000 FORMAT (A/                                                            &
-             '  step    time  # of parts   lPE sent/recv  rPE sent/recv  ',&
-             'sPE sent/recv  nPE sent/recv  max # of parts'/               &
+8000 FORMAT (A/                                                                &
+             '  step    time  # of parts   lPE sent/recv  rPE sent/recv  ',    &
+             'sPE sent/recv  nPE sent/recv  max # of parts'/                   &
              103('-'))
 
Index: /palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- /palm/trunk/SOURCE/check_parameters.f90	(revision 1319)
+++ /palm/trunk/SOURCE/check_parameters.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -167,143 +173,4 @@
 ! New cpp directive "__check" implemented which is used by check_namelist_files
 !
-! 774 2011-10-27 13:34:16Z letzel
-! bugfix for prescribed u,v-profiles
-!
-! 767 2011-10-14 06:39:12Z raasch
-! Calculating u,v-profiles from given profiles by linear interpolation.
-! bugfix: dirichlet_0 conditions for ug/vg moved from init_3d_model to here
-!
-! 707 2011-03-29 11:39:40Z raasch
-! setting of bc_lr/ns_dirrad/raddir
-!
-! 689 2011-02-20 19:31:12z gryschka
-! Bugfix for some logical expressions 
-! (syntax was not compatible with all compilers)
-!
-! 680 2011-02-04 23:16:06Z gryschka 
-! init_vortex is not allowed with volume_flow_control
-!
-! 673 2011-01-18 16:19:48Z suehring
-! Declaration of ws_scheme_sca and ws_scheme_mom added (moved from advec_ws).
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Exchange of parameters between ocean and atmosphere via PE0
-! Check for illegal combination of ws-scheme and timestep scheme.
-! Check for topography and ws-scheme.
-! Check for not cyclic boundary conditions in combination with ws-scheme and
-! loop_optimization = 'vector'.
-! Check for call_psolver_at_all_substeps and ws-scheme for momentum_advec.
-! Different processor/grid topology in atmosphere and ocean is now allowed!
-! Bugfixes in checking for conserve_volume_flow_mode
-! 600 2010-11-24 16:10:51Z raasch
-! change due to new default value of surface_waterflux
-! 580 2010-10-05 13:59:11Z heinze
-! renaming of ws_vertical_gradient_level to subs_vertical_gradient_level
-!
-! 567 2010-10-01 10:46:30Z helmke
-! calculating masks changed
-!
-! 564 2010-09-30 13:18:59Z helmke
-! palm message identifiers of masked output changed, 20 replaced by max_masks 
-!
-! 553 2010-09-01 14:09:06Z weinreis
-! masks is calculated and removed from inipar
-! 
-! 531 2010-04-21 06:47:21Z heinze
-! Bugfix: unit of hyp changed to dbar 
-!
-! 524 2010-03-30 02:04:51Z raasch
-! Bugfix: "/" in netcdf profile variable names replaced by ":"
-!
-! 493 2010-03-01 08:30:24Z raasch
-! netcdf_data_format is checked
-!
-! 411 2009-12-11 14:15:58Z heinze
-! Enabled passive scalar/humidity wall fluxes for non-flat topography
-! Initialization of large scale vertical motion (subsidence/ascent)
-!
-! 410 2009-12-04 17:05:40Z letzel
-! masked data output
-!
-! 388 2009-09-23 09:40:33Z raasch
-! Check profiles fpr prho and hyp.
-! Bugfix: output of averaged 2d/3d quantities requires that an avaraging
-! interval has been set, respective error message is included
-! bc_lr_cyc and bc_ns_cyc are set,
-! initializing_actions='read_data_for_recycling' renamed to 'cyclic_fill'
-! Check for illegal entries in section_xy|xz|yz that exceed nz+1|ny+1|nx+1
-! Coupling with independent precursor runs.
-! Check particle_color, particle_dvrpsize, color_interval, dvrpsize_interval
-! Bugfix: pressure included for profile output
-! Check pressure gradient conditions
-! topography_grid_convention moved from user_check_parameters
-! 'single_street_canyon'
-! Added shf* and qsws* to the list of available output data
-!
-! 222 2009-01-12 16:04:16Z letzel
-! +user_check_parameters
-! Output of messages replaced by message handling routine.
-! Implementation of an MPI-1 coupling: replaced myid with target_id, 
-! deleted __mpi2 directives
-! Check that PALM is called with mrun -K parallel for coupling
-!
-! 197 2008-09-16 15:29:03Z raasch
-! Bug fix: Construction of vertical profiles when 10 gradients have been 
-! specified in the parameter list (ug, vg, pt, q, sa, lad)
-!   
-! Strict grid matching along z is not needed for mg-solver.
-! Leaf area density (LAD) explicitly set to its surface value at k=0
-! Case of reading data for recycling included in initializing_actions,
-! check of turbulent_inflow and calculation of recycling_plane.
-! q*2 profile added
-!
-! 138 2007-11-28 10:03:58Z letzel
-! Plant canopy added
-! Allow new case bc_uv_t = 'dirichlet_0' for channel flow.
-! Multigrid solver allows topography, checking of dt_sort_particles
-! Bugfix: initializing u_init and v_init in case of ocean runs
-!
-! 109 2007-08-28 15:26:47Z letzel
-! Check coupling_mode and set default (obligatory) values (like boundary
-! conditions for temperature and fluxes) in case of coupled runs.
-! +profiles for w*p* and w"e
-! Bugfix: Error message concerning output of particle concentration (pc)
-! modified
-! More checks and more default values for coupled runs
-! allow data_output_pr= q, wq, w"q", w*q* for humidity = .T. (instead of 
-! cloud_physics = .T.)
-! Rayleigh damping for ocean fixed.
-! Check and, if necessary, set default value for dt_coupling
-!
-! 97 2007-06-21 08:23:15Z raasch
-! Initial salinity profile is calculated, salinity boundary conditions are
-! checked,
-! z_max_do1d is checked only in case of ocean = .f.,
-! +initial temperature and geostrophic velocity profiles for the ocean version,
-! use_pt_reference renamed use_reference
-!
-! 89 2007-05-25 12:08:31Z raasch
-! Check for user-defined profiles
-!
-! 75 2007-03-22 09:54:05Z raasch
-! "by_user" allowed as initializing action, -data_output_ts,
-! leapfrog with non-flat topography not allowed any more, loop_optimization
-! and pt_reference are checked, moisture renamed humidity,
-! output of precipitation amount/rate and roughnes length + check
-! possible negative humidities are avoided in initial profile,
-! dirichlet/neumann changed to dirichlet/radiation, etc.,
-! revision added to run_description_header
-!
-! 20 2007-02-26 00:12:32Z raasch
-! Temperature and humidity gradients at top are now calculated for nzt+1,
-! top_heatflux and respective boundary condition bc_pt_t is checked
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.61  2006/08/04 14:20:25  raasch
-! do2d_unit and do3d_unit now defined as 2d-arrays, check of
-! use_upstream_for_tke, default value for dt_dopts,
-! generation of file header moved from routines palm and header to here
-!
 ! Revision 1.1  1997/08/26 06:29:23  raasch
 ! Initial revision
@@ -322,4 +189,5 @@
     USE grid_variables
     USE indices
+    USE kinds
     USE model_1d
     USE netcdf_control
@@ -335,16 +203,28 @@
     IMPLICIT NONE
 
-    CHARACTER (LEN=1)   ::  sq
-    CHARACTER (LEN=6)   ::  var
-    CHARACTER (LEN=7)   ::  unit
-    CHARACTER (LEN=8)   ::  date
-    CHARACTER (LEN=10)  ::  time
-    CHARACTER (LEN=40)  ::  coupling_string
-    CHARACTER (LEN=100) ::  action
-
-    INTEGER ::  i, ilen, iremote = 0, j, k, kk, netcdf_data_format_save, &
-                position, prec
-    LOGICAL ::  found, ldum
-    REAL    ::  gradient, remote = 0.0, simulation_time_since_reference
+    CHARACTER (LEN=1)   ::  sq                       !: 
+    CHARACTER (LEN=6)   ::  var                      !: 
+    CHARACTER (LEN=7)   ::  unit                     !: 
+    CHARACTER (LEN=8)   ::  date                     !: 
+    CHARACTER (LEN=10)  ::  time                     !: 
+    CHARACTER (LEN=40)  ::  coupling_string          !: 
+    CHARACTER (LEN=100) ::  action                   !: 
+
+    INTEGER(iwp) ::  i                               !: 
+    INTEGER(iwp) ::  ilen                            !: 
+    INTEGER(iwp) ::  iremote = 0                     !: 
+    INTEGER(iwp) ::  j                               !: 
+    INTEGER(iwp) ::  k                               !: 
+    INTEGER(iwp) ::  kk                              !: 
+    INTEGER(iwp) ::  netcdf_data_format_save         !: 
+    INTEGER(iwp) ::  position                        !:
+    INTEGER(iwp) ::  prec                            !: 
+    
+    LOGICAL     ::  found                            !: 
+    LOGICAL     ::  ldum                             !: 
+    
+    REAL(wp)    ::  gradient                         !: 
+    REAL(wp)    ::  remote = 0.0                     !: 
+    REAL(wp)    ::  simulation_time_since_reference  !: 
 
 !
Index: /palm/trunk/SOURCE/close_file.f90
===================================================================
--- /palm/trunk/SOURCE/close_file.f90	(revision 1319)
+++ /palm/trunk/SOURCE/close_file.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -37,38 +43,4 @@
 ! 964 2012-07-26 09:14:24Z raasch
 ! old profil-units (40:49) and respective code removed
-!
-! 564 2010-09-30 13:18:59Z helmke
-! start number of mask output files changed to 201, netcdf message identifiers
-! of masked output changed
-!
-! 493 2010-03-01 08:30:24Z raasch
-! Adjustments for NetCDF parallel data output
-!
-! 410 2009-12-04 17:05:40Z letzel
-! masked data output
-!
-! 263 2009-03-18 12:26:04Z heinze
-! Output of NetCDF messages with aid of message handling routine.
-!
-! Feb. 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.10  2006/08/22 13:50:01  raasch
-! xz and yz cross sections now up to nzt+1
-!
-! Revision 1.1  2001/01/02 17:23:41  raasch
-! Initial revision
-!
-! Last revision before renaming subroutine  2001/01/01  raasch
-! Subroutine name changed from close_files to close_file. Closing of a single
-! file is allowed by passing its file-id as an argument. Variable openfile now
-! is of type file_status and contains a flag which indicates if a file has
-! been opened before. Old revision remarks deleted.
-!
-! Revision 1.13 (close_files) 2000/12/20 09:10:24  letzel
-! All comments translated into English.
-!
-! Revision 1.12 (close_files) 1999/03/02 09:22:46  raasch
-! FLD-Header fuer komprimierte 3D-Daten
 !
 ! Revision 1.1 (close_files) 1997/08/11 06:11:18  raasch
@@ -83,25 +55,43 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  do2d_xz_n, do2d_xy_n, do2d_yz_n, do3d_avs_n, do3d_compress,     &
+               host, iso2d_output, max_masks, mid, netcdf_data_format,         &
+               netcdf_output, nz_do3d, openfile, run_description_header,       &
+               z_max_do2d
+                
+    USE grid_variables,                                                        &
+        ONLY:  dy
+        
+    USE indices,                                                               &
+        ONLY:  nx, ny, nz
+        
+    USE kinds
+    
     USE netcdf_control
-    USE pegrid
-    USE profil_parameter
-    USE statistics
+                
+    USE pegrid                                           
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=10)  ::  datform = 'lit_endian'
-    CHARACTER (LEN=80)  ::  title
-
-    INTEGER ::  av, dimx, dimy, &
-                fid, file_id, planz
-
-    LOGICAL ::  checkuf = .TRUE., datleg = .TRUE., dp = .FALSE.
-
-    REAL ::  sizex, sizey, yright
-
-    NAMELIST /GLOBAL/  checkuf, datform, dimx, dimy, dp, planz, &
+    CHARACTER (LEN=10)  ::  datform = 'lit_endian' !: 
+    CHARACTER (LEN=80)  ::  title                  !: 
+
+    INTEGER(iwp) ::  av           !: 
+    INTEGER(iwp) ::  dimx         !: 
+    INTEGER(iwp) ::  dimy         !: 
+    INTEGER(iwp) ::  fid          !: 
+    INTEGER(iwp) ::  file_id      !: 
+    INTEGER(iwp) ::  planz        !: 
+
+    LOGICAL ::  checkuf = .TRUE.  !: 
+    LOGICAL ::  datleg = .TRUE.   !: 
+    LOGICAL ::  dbp = .FALSE.     !: 
+
+    REAL(wp) ::  sizex            !: 
+    REAL(wp) ::  sizey            !: 
+    REAL(wp) ::  yright           !: 
+
+    NAMELIST /GLOBAL/  checkuf, datform, dimx, dimy, dbp, planz,               &
                        title
     NAMELIST /RAHMEN/  datleg
@@ -140,10 +130,10 @@
                    yright = ( ny + 1.0 ) * dy
                    IF ( host(1:3) == 'ibm'  .OR.  host(1:3) == 't3e' )  THEN
-                      checkuf = .FALSE.; dp = .TRUE.
+                      checkuf = .FALSE.; dbp = .TRUE.
                    ENDIF
                    IF ( host(1:3) == 'ibm'  .OR.  host(1:3) == 'nec' )  THEN
                       datform = 'big_endian'
                    ENDIF
-                   OPEN ( 90, FILE='PLOT2D_XY_GLOBAL', FORM='FORMATTED', &
+                   OPEN ( 90, FILE='PLOT2D_XY_GLOBAL', FORM='FORMATTED',       &
                               DELIM='APOSTROPHE' )
                    WRITE ( 90, GLOBAL )
@@ -163,10 +153,10 @@
                    yright = z_max_do2d
                    IF ( host(1:3) == 'ibm'  .OR.  host(1:3) == 't3e' )  THEN
-                      checkuf = .FALSE.; dp = .TRUE.
+                      checkuf = .FALSE.; dbp = .TRUE.
                    ENDIF
                    IF ( host(1:3) == 'ibm'  .OR.  host(1:3) == 'nec' )  THEN
                       datform = 'big_endian'
                    ENDIF
-                   OPEN ( 90, FILE='PLOT2D_XZ_GLOBAL', FORM='FORMATTED', &
+                   OPEN ( 90, FILE='PLOT2D_XZ_GLOBAL', FORM='FORMATTED',       &
                               DELIM='APOSTROPHE' )
                    WRITE ( 90, GLOBAL )
@@ -186,10 +176,10 @@
                    yright = z_max_do2d
                    IF ( host(1:3) == 'ibm'  .OR.  host(1:3) == 't3e' )  THEN
-                      checkuf = .FALSE.; dp = .TRUE.
+                      checkuf = .FALSE.; dbp = .TRUE.
                    ENDIF
                    IF ( host(1:3) == 'ibm'  .OR.  host(1:3) == 'nec' )  THEN
                       datform = 'big_endian'
                    ENDIF
-                   OPEN ( 90, FILE='PLOT2D_YZ_GLOBAL', FORM='FORMATTED', &
+                   OPEN ( 90, FILE='PLOT2D_YZ_GLOBAL', FORM='FORMATTED',       &
                               DELIM='APOSTROPHE' )
                    WRITE ( 90, GLOBAL )
@@ -201,9 +191,9 @@
 !--             Write header for FLD-file
                 IF ( do3d_compress )  THEN
-                   WRITE ( 32, 3200)  ' compressed ',                       &
-                                      TRIM( run_description_header ), nx+2, &
+                   WRITE ( 32, 3200)  ' compressed ',                          &
+                                      TRIM( run_description_header ), nx+2,    &
                                       ny+2, nz_do3d+1, do3d_avs_n
                 ELSE
-                   WRITE ( 32, 3200)  ' ', TRIM( run_description_header ), &
+                   WRITE ( 32, 3200)  ' ', TRIM( run_description_header ),     &
                                       nx+2, ny+2, nz_do3d+1, do3d_avs_n
                 ENDIF
@@ -212,5 +202,5 @@
              CASE ( 101 )
 
-                IF ( netcdf_output  .AND.  &
+                IF ( netcdf_output  .AND.                                      &
                      ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
                    nc_stat = NF90_CLOSE( id_set_xy(0) )
@@ -220,5 +210,5 @@
              CASE ( 102 )
 
-                IF ( netcdf_output  .AND.  &
+                IF ( netcdf_output  .AND.                                      &
                      ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
                    nc_stat = NF90_CLOSE( id_set_xz(0) )
@@ -228,5 +218,5 @@
              CASE ( 103 )
 
-                IF ( netcdf_output  .AND.  &
+                IF ( netcdf_output  .AND.                                      &
                      ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
                    nc_stat = NF90_CLOSE( id_set_yz(0) )
@@ -279,5 +269,5 @@
              CASE ( 111 )
 
-                IF ( netcdf_output  .AND.  &
+                IF ( netcdf_output  .AND.                                      &
                      ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
                    nc_stat = NF90_CLOSE( id_set_xy(1) )
@@ -287,5 +277,5 @@
              CASE ( 112 )
 
-                IF ( netcdf_output  .AND.  &
+                IF ( netcdf_output  .AND.                                      &
                      ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
                    nc_stat = NF90_CLOSE( id_set_xz(1) )
@@ -295,5 +285,5 @@
              CASE ( 113 )
 
-                IF ( netcdf_output  .AND.  &
+                IF ( netcdf_output  .AND.                                      &
                      ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
                    nc_stat = NF90_CLOSE( id_set_yz(1) )
@@ -303,5 +293,5 @@
              CASE ( 116 )
 
-                IF ( netcdf_output  .AND.  &
+                IF ( netcdf_output  .AND.                                      &
                      ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
                    nc_stat = NF90_CLOSE( id_set_3d(1) )
@@ -311,5 +301,5 @@
              CASE ( 201:200+2*max_masks )
 	     
-                IF ( netcdf_output  .AND.  &
+                IF ( netcdf_output  .AND.                                      &
                      ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
 !
@@ -340,14 +330,14 @@
 !
 !-- Formats
-3200 FORMAT ('# AVS',A,'field file'/ &
-             '#'/                &
-             '# ',A/             &
-             'ndim=3'/           &
-             'dim1=',I5/         &
-             'dim2=',I5/         &
-             'dim3=',I5/         &
-             'nspace=3'/         &
-             'veclen=',I5/       &
-             'data=xdr_float'/   &
+3200 FORMAT ('# AVS',A,'field file'/                                           &
+             '#'/                                                              &
+             '# ',A/                                                           &
+             'ndim=3'/                                                         &
+             'dim1=',I5/                                                       &
+             'dim2=',I5/                                                       &
+             'dim3=',I5/                                                       &
+             'nspace=3'/                                                       &
+             'veclen=',I5/                                                     &
+             'data=xdr_float'/                                                 &
              'field=rectilinear')
 4000 FORMAT ('time averaged over',F7.1,' s')
Index: /palm/trunk/SOURCE/compute_vpt.f90
===================================================================
--- /palm/trunk/SOURCE/compute_vpt.f90	(revision 1319)
+++ /palm/trunk/SOURCE/compute_vpt.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -32,13 +38,4 @@
 ! Bugfix: wrong factor in calculation of vpt in case of cloud droplets
 !
-! 799 2011-12-21 17:48:03Z franke
-! Bugfix: ql is now included in calculation of vpt in case of 
-!         cloud droplets 
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.5  2001/03/30 06:58:52  raasch
-! Translation of remaining German identifiers (variables, subroutines, etc.)
-!
 ! Revision 1.1  2000/04/13 14:40:53  schroeter
 ! Initial revision
@@ -48,20 +45,29 @@
 ! -------------
 ! Computation of the virtual potential temperature 
-!-------------------------------------------------------------------------------!
+!------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE indices
-    USE cloud_parameters
-    USE control_parameters
+    USE arrays_3d,                                                             &
+        ONLY:  pt, q, ql, vpt
+        
+    USE indices,                                                               &
+        ONLY:  nzb, nzt
+        
+    USE cloud_parameters,                                                      &
+        ONLY:  l_d_cp, pt_d_t
+        
+    USE control_parameters,                                                    &
+        ONLY:  cloud_droplets, cloud_physics
+        
+    USE kinds
 
     IMPLICIT NONE
 
-    INTEGER :: k
+    INTEGER(iwp) :: k   !: 
 
-    IF ( .NOT. cloud_physics .AND. .NOT. cloud_droplets ) THEN
+    IF ( .NOT. cloud_physics  .AND.  .NOT. cloud_droplets )  THEN
        vpt = pt * ( 1.0 + 0.61 * q )
-    ELSE IF (cloud_physics) THEN
+    ELSE IF (cloud_physics)  THEN
        DO  k = nzb, nzt+1
-          vpt(k,:,:) = ( pt(k,:,:) + pt_d_t(k) * l_d_cp * ql(k,:,:) ) * &
+          vpt(k,:,:) = ( pt(k,:,:) + pt_d_t(k) * l_d_cp * ql(k,:,:) ) *        &
                        ( 1.0 + 0.61 * q(k,:,:) - 1.61 * ql(k,:,:) ) 
        ENDDO
Index: /palm/trunk/SOURCE/coriolis.f90
===================================================================
--- /palm/trunk/SOURCE/coriolis.f90	(revision 1319)
+++ /palm/trunk/SOURCE/coriolis.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -38,19 +44,4 @@
 ! 1015 2012-09-27 09:23:24Z raasch
 ! accelerator version (*_acc) added
-!
-! 254 2009-03-05 15:33:42Z heinze
-! Output of messages replaced by message handling routine.
-!
-! 106 2007-08-16 14:30:26Z raasch
-! loops for u and v are starting from index nxlu, nysv, respectively (needed
-! for non-cyclic boundary conditions)
-!
-! 75 2007-03-22 09:54:05Z raasch
-! uxrp, vynp eliminated
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.12  2006/02/23 10:08:57  raasch
-! nzb_2d replaced by nzb_u/v/w_inner
 !
 ! Revision 1.1  1997/08/29 08:57:38  raasch
@@ -83,12 +74,22 @@
     SUBROUTINE coriolis( component )
 
-       USE arrays_3d
-       USE control_parameters
-       USE indices
-       USE pegrid
+       USE arrays_3d,                                                          &
+           ONLY:  tend, u, ug, v, vg, w 
+           
+       USE control_parameters,                                                 &
+           ONLY:  f, fs, message_string
+           
+       USE indices,                                                            &
+           ONLY:  nxl, nxlu, nxr, nyn, nys, nysv, nzb_u_inner, nzb_v_inner,    &
+                  nzb_w_inner, nzt
+                   
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  component, i, j, k
+       INTEGER(iwp) ::  component  !: 
+       INTEGER(iwp) ::  i          !: 
+       INTEGER(iwp) ::  j          !: 
+       INTEGER(iwp) ::  k          !: 
 
 
@@ -103,9 +104,9 @@
                 DO  j = nys, nyn
                    DO  k = nzb_u_inner(j,i)+1, nzt
-                      tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25 *            &
-                                   ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +   &
-                                     v(k,j+1,i) ) - vg(k) )                   &
-                                             - fs *    ( 0.25 *               &
-                                   ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + &
+                      tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25 *             &
+                                   ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +    &
+                                     v(k,j+1,i) ) - vg(k) )                    &
+                                             - fs *    ( 0.25 *                &
+                                   ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) +  &
                                      w(k,j,i)   ) &
                                                           )
@@ -120,6 +121,6 @@
                 DO  j = nysv, nyn
                    DO  k = nzb_v_inner(j,i)+1, nzt
-                      tend(k,j,i) = tend(k,j,i) - f *     ( 0.25 *          &
-                                   ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + &
+                      tend(k,j,i) = tend(k,j,i) - f *     ( 0.25 *             &
+                                   ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) +    &
                                      u(k,j,i+1) ) - ug(k) )
                    ENDDO
@@ -133,6 +134,6 @@
                 DO  j = nys, nyn
                    DO  k = nzb_w_inner(j,i)+1, nzt
-                      tend(k,j,i) = tend(k,j,i) + fs * 0.25 *             &
-                                   ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + &
+                      tend(k,j,i) = tend(k,j,i) + fs * 0.25 *                  &
+                                   ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +      &
                                      u(k+1,j,i+1) )
                    ENDDO
@@ -155,12 +156,22 @@
     SUBROUTINE coriolis_acc( component )
 
-       USE arrays_3d
-       USE control_parameters
-       USE indices
-       USE pegrid
+       USE arrays_3d,                                                          &
+           ONLY:  tend, u, ug, v, vg, w 
+           
+       USE control_parameters,                                                 &
+           ONLY:  f, fs, message_string
+           
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nzb_u_inner,              &
+                  nzb_v_inner, nzb_w_inner, nzt
+                   
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  component, i, j, k
+       INTEGER(iwp) ::  component  !: 
+       INTEGER(iwp) ::  i          !:
+       INTEGER(iwp) ::  j          !: 
+       INTEGER(iwp) ::  k          !:
 
 
@@ -215,6 +226,6 @@
                    DO  k = 1, nzt
                       IF  ( k > nzb_w_inner(j,i) )  THEN
-                         tend(k,j,i) = tend(k,j,i) + fs * 0.25 *             &
-                                      ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + &
+                         tend(k,j,i) = tend(k,j,i) + fs * 0.25 *               &
+                                      ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +   &
                                         u(k+1,j,i+1) )
                       ENDIF
@@ -239,12 +250,21 @@
     SUBROUTINE coriolis_ij( i, j, component )
 
-       USE arrays_3d
-       USE control_parameters
-       USE indices
-       USE pegrid
-
+       USE arrays_3d,                                                          &
+           ONLY:  tend, u, ug, v, vg, w 
+           
+       USE control_parameters,                                                 &
+           ONLY:  f, fs, message_string
+           
+       USE indices,                                                            &
+           ONLY:  nzb_u_inner, nzb_v_inner, nzb_w_inner, nzt
+           
+       USE kinds
+       
        IMPLICIT NONE
 
-       INTEGER ::  component, i, j, k
+       INTEGER(iwp) ::  component  !: 
+       INTEGER(iwp) ::  i          !:
+       INTEGER(iwp) ::  j          !: 
+       INTEGER(iwp) ::  k          !:
 
 !
@@ -256,11 +276,10 @@
           CASE ( 1 )
              DO  k = nzb_u_inner(j,i)+1, nzt
-                tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25 *               &
-                                ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +   &
-                                  v(k,j+1,i) ) - vg(k) )                   &
-                                          - fs *    ( 0.25 *               &
-                                ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + &
-                                  w(k,j,i)   ) &
-                                                    )
+                tend(k,j,i) = tend(k,j,i) + f  *    ( 0.25 *                   &
+                                ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) +       &
+                                  v(k,j+1,i) ) - vg(k) )                       &
+                                          - fs *    ( 0.25 *                   &
+                                ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) +     &
+                                  w(k,j,i)   ) )
              ENDDO
 
@@ -269,6 +288,6 @@
           CASE ( 2 )
              DO  k = nzb_v_inner(j,i)+1, nzt
-                tend(k,j,i) = tend(k,j,i) - f *     ( 0.25 *             &
-                                ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + &
+                tend(k,j,i) = tend(k,j,i) - f *     ( 0.25 *                   &
+                                ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) +       &
                                   u(k,j,i+1) ) - ug(k) )
              ENDDO
@@ -278,6 +297,6 @@
           CASE ( 3 )
              DO  k = nzb_w_inner(j,i)+1, nzt
-                tend(k,j,i) = tend(k,j,i) + fs * 0.25 * &
-                                ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + &
+                tend(k,j,i) = tend(k,j,i) + fs * 0.25 *                        &
+                                ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) +         &
                                   u(k+1,j,i+1) )
              ENDDO
Index: /palm/trunk/SOURCE/cpulog.f90
===================================================================
--- /palm/trunk/SOURCE/cpulog.f90	(revision 1319)
+++ /palm/trunk/SOURCE/cpulog.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -32,20 +38,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 274 2009-03-26 15:11:21Z heinze
-! Output of messages replaced by message handling routine.
-! Type of count and count_rate changed to default INTEGER on NEC machines
-!
-! 225 2009-01-26 14:44:20Z raasch
-! Type of count and count_rate changed to INTEGER(8)
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Preprocessor strings for different linux clusters changed to "lc",
-! preprocessor directives for old systems removed
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.24  2006/06/02 15:12:17  raasch
-! cpp-directives extended for lctit
 !
 ! Revision 1.1  1997/07/24 11:12:29  raasch
@@ -58,6 +48,13 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE indices,  ONLY: nx, ny, nz
+    USE control_parameters,                                                    &
+        ONLY: message_string, nr_timesteps_this_run, run_description_header,   &
+              synchronous_exchange
+               
+    USE indices,                                                               &
+        ONLY: nx, ny, nz
+        
+    USE kinds
+    
     USE pegrid
 
@@ -65,5 +62,5 @@
 
     PRIVATE
-    PUBLIC   cpu_log, cpu_log_barrierwait, cpu_log_nowait, cpu_statistics, &
+    PUBLIC   cpu_log, cpu_log_barrierwait, cpu_log_nowait, cpu_statistics,     &
              initial_wallclock_time, log_point, log_point_s
 
@@ -76,16 +73,24 @@
     END INTERFACE cpu_statistics
 
-    INTEGER, PARAMETER ::  cpu_log_continue = 0, cpu_log_pause = 1, &
-                           cpu_log_start = 2, cpu_log_stop = 3
-
-    LOGICAL            ::  cpu_log_barrierwait = .FALSE.
-    LOGICAL, PARAMETER ::  cpu_log_nowait = .FALSE.
-
-    REAL ::  initial_wallclock_time
+    INTEGER(iwp), PARAMETER ::  cpu_log_continue = 0  !: 
+    INTEGER(iwp), PARAMETER ::  cpu_log_pause = 1     !: 
+    INTEGER(iwp), PARAMETER ::  cpu_log_start = 2     !: 
+    INTEGER(iwp), PARAMETER ::  cpu_log_stop = 3      !: 
+
+    LOGICAL            ::  cpu_log_barrierwait = .FALSE.  !: 
+    LOGICAL, PARAMETER ::  cpu_log_nowait = .FALSE.       !: 
+
+    REAL(wp) ::  initial_wallclock_time  !: 
 
     TYPE logpoint
-       REAL               ::  isum, ivect, mean, mtime, mtimevec, sum, vector
-       INTEGER            ::  counts
-       CHARACTER (LEN=20) ::  place
+       REAL(wp)           ::  isum       !: 
+       REAL(wp)           ::  ivect      !: 
+       REAL(wp)           ::  mean       !: 
+       REAL(wp)           ::  mtime      !: 
+       REAL(wp)           ::  mtimevec   !: 
+       REAL(wp)           ::  sum        !: 
+       REAL(wp)           ::  vector     !: 
+       INTEGER(iwp)       ::  counts     !: 
+       CHARACTER (LEN=20) ::  place      !: 
     END TYPE logpoint
 
@@ -103,17 +108,23 @@
        IMPLICIT NONE
 
-       CHARACTER (LEN=*)           ::  modus, place
-       LOGICAL                     ::  wait_allowed
-       LOGICAL, OPTIONAL           ::  barrierwait
-       LOGICAL, SAVE               ::  first = .TRUE.
-       REAL                        ::  mtime = 0.0, mtimevec = 0.0
-       TYPE(logpoint)              ::  log_event
+       CHARACTER (LEN=*) ::  modus              !: 
+       CHARACTER (LEN=*) ::  place              !: 
+       
+       LOGICAL           ::  wait_allowed       !: 
+       LOGICAL, OPTIONAL ::  barrierwait        !: 
+       LOGICAL, SAVE     ::  first = .TRUE.     !: 
+       
+       REAL(wp)          ::  mtime = 0.0        !: 
+       REAL(wp)          ::   mtimevec = 0.0    !: 
+       TYPE(logpoint)    ::  log_event          !: 
 
 #if defined( __lc ) || defined( __decalpha )
-       INTEGER(8)                  ::  count, count_rate
+       INTEGER(idp)     ::  count        !: 
+       INTEGER(idp)     ::  count_rate   !: 
 #elif defined( __nec )
-       INTEGER                     ::  count, count_rate
+       INTEGER(iwp)      ::  count       !: 
+       INTEGER(iwp)      ::  count_rate  !: 
 #elif defined( __ibm )
-       INTEGER(8)                  ::  IRTC
+       INTEGER(idp)     ::  IRTC         !: 
 #endif
 
@@ -124,5 +135,5 @@
           log_event%place = place
        ELSEIF ( log_event%place /= place )  THEN
-          WRITE( message_string, * ) 'wrong argument & expected: ', &
+          WRITE( message_string, * ) 'wrong argument & expected: ',            &
                             TRIM(log_event%place), '  given: ',  TRIM( place )
           CALL message( 'cpu_log', 'PA0174', 1, 2, 0, 6, 0 )
@@ -142,5 +153,5 @@
 !--    PEs that have not yet finished
 #if defined( __parallel )
-       IF ( cpu_log_barrierwait  .AND.  wait_allowed  .AND.  &
+       IF ( cpu_log_barrierwait  .AND.  wait_allowed  .AND.                    &
             ( modus == 'start'  .OR.  modus == 'continue' ) )  THEN
           CALL MPI_BARRIER( comm2d, ierr )
@@ -167,7 +178,7 @@
        ELSEIF ( modus == 'pause' )  THEN
           IF ( ( mtime - log_event%mtime ) < 0.0  .AND.  first )  THEN
-             WRITE( message_string, * ) 'negative time interval occured',         &
-                         ' &PE',myid,' L=PAUSE "',TRIM(log_event%place),'" new=', &
-                         mtime,' last=',log_event%mtime
+             WRITE( message_string, * ) 'negative time interval occured',      &
+                         ' &PE',myid,' L=PAUSE "',TRIM(log_event%place),       &
+                         '" new=', mtime,' last=',log_event%mtime
              CALL message( 'cpu_log', 'PA0176', 0, 1, -1, 6, 0 )
              first = .FALSE.
@@ -176,7 +187,7 @@
           log_event%ivect    = log_event%ivect  + mtimevec - log_event%mtimevec
        ELSEIF ( modus == 'stop' )  THEN
-          IF ( ( mtime - log_event%mtime + log_event%isum ) < 0.0  .AND. &
+          IF ( ( mtime - log_event%mtime + log_event%isum ) < 0.0  .AND.       &
                first )  THEN
-             WRITE( message_string, * ) 'negative time interval occured',        &
+             WRITE( message_string, * ) 'negative time interval occured',      &
                          ' &PE',myid,' L=STOP "',TRIM(log_event%place),'" new=', &
                          mtime,' last=',log_event%mtime,' isum=',log_event%isum
@@ -188,5 +199,5 @@
           log_event%sum      = log_event%sum  + log_event%mtime
           IF ( log_event%sum < 0.0  .AND.  first )  THEN
-             WRITE( message_string, * ) 'negative time interval occured',        &
+             WRITE( message_string, * ) 'negative time interval occured',      &
                          ' &PE',myid,' L=STOP "',TRIM(log_event%place),'" sum=', &
                                          log_event%sum,' mtime=',log_event%mtime
@@ -218,9 +229,15 @@
        IMPLICIT NONE
 
-       INTEGER    ::  i, ii(1), iii, sender
-       REAL       ::  average_cputime
-       REAL, SAVE ::  norm = 1.0
-       REAL, DIMENSION(:),   ALLOCATABLE ::  pe_max, pe_min, pe_rms, sum
-       REAL, DIMENSION(:,:), ALLOCATABLE ::  pe_log_points
+       INTEGER(iwp)    ::  i               !: 
+       INTEGER(iwp)    ::  ii(1)           !: 
+       INTEGER(iwp)    ::  iii             !: 
+       INTEGER(iwp)    ::  sender          !: 
+       REAL(wp)       ::  average_cputime  !: 
+       REAL(wp), SAVE ::  norm = 1.0       !: 
+       REAL(wp), DIMENSION(:),   ALLOCATABLE ::  pe_max        !: 
+       REAL(wp), DIMENSION(:),   ALLOCATABLE ::  pe_min        !: 
+       REAL(wp), DIMENSION(:),   ALLOCATABLE ::  pe_rms        !: 
+       REAL(wp), DIMENSION(:),   ALLOCATABLE ::  sum           !: 
+       REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pe_log_points !: 
 
 
@@ -240,6 +257,6 @@
 !
 !--       Allocate and initialize temporary arrays needed for statistics
-          ALLOCATE( pe_max( SIZE( log_point ) ), pe_min( SIZE( log_point ) ), &
-                    pe_rms( SIZE( log_point ) ),                              &
+          ALLOCATE( pe_max( SIZE( log_point ) ), pe_min( SIZE( log_point ) ),  &
+                    pe_rms( SIZE( log_point ) ),                               &
                     pe_log_points( SIZE( log_point ), 0:numprocs-1 ) )
           pe_min = log_point%sum
@@ -251,5 +268,5 @@
 !--       Receive data from all PEs
           DO  i = 1, numprocs-1
-             CALL MPI_RECV( pe_max(1), SIZE( log_point ), MPI_REAL, &
+             CALL MPI_RECV( pe_max(1), SIZE( log_point ), MPI_REAL,            &
                             i, i, comm2d, status, ierr )
              sender = status(MPI_SOURCE)
@@ -270,6 +287,6 @@
 !--          Calculate rms
              DO  i = 0, numprocs-1
-                pe_rms(iii) = pe_rms(iii) + ( &
-                                    pe_log_points(iii,i) - log_point(iii)%sum &
+                pe_rms(iii) = pe_rms(iii) + (                                  &
+                                    pe_log_points(iii,i) - log_point(iii)%sum  &
                                             )**2
              ENDDO
Index: /palm/trunk/SOURCE/cuda_fft_interfaces.f90
===================================================================
--- /palm/trunk/SOURCE/cuda_fft_interfaces.f90	(revision 1319)
+++ /palm/trunk/SOURCE/cuda_fft_interfaces.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -50,12 +56,12 @@
 #if defined ( __cuda_fft )
 
-    INTEGER :: CUFFT_FORWARD = -1,  &
-               CUFFT_INVERSE =  1,  &
-               CUFFT_R2C = Z'2a',   &    ! Real to Complex (interleaved)
-               CUFFT_C2R = Z'2c',   &    ! Complex (interleaved) to Real
-               CUFFT_C2C = Z'29',   &    ! Complex to Complex, interleaved
-               CUFFT_D2Z = Z'6a',   &    ! Double to Double-Complex
-               CUFFT_Z2D = Z'6c',   &    ! Double-Complex to Double
-               CUFFT_Z2Z = Z'69'         ! Double-Complex to Double-Complex
+    INTEGER(iwp) ::  CUFFT_FORWARD = -1   !:
+    INTEGER(iwp) ::  CUFFT_INVERSE =  1   !:
+    INTEGER(iwp) ::  CUFFT_R2C = Z'2a'    !: Real to Complex (interleaved)
+    INTEGER(iwp) ::  CUFFT_C2R = Z'2c'    !: Complex (interleaved) to Real
+    INTEGER(iwp) ::  CUFFT_C2C = Z'29'    !: Complex to Complex, interleaved
+    INTEGER(iwp) ::  CUFFT_D2Z = Z'6a'    !: Double to Double-Complex
+    INTEGER(iwp) ::  CUFFT_Z2D = Z'6c'    !: Double-Complex to Double
+    INTEGER(iwp) ::  CUFFT_Z2Z = Z'69'    !: Double-Complex to Double-Complex
 
     PUBLIC
@@ -70,7 +76,8 @@
           USE ISO_C_BINDING
 
-          INTEGER(C_INT) ::  plan
-          INTEGER(C_INT), value ::  batch, nx, type
-
+          INTEGER(C_INT)        ::  plan   !: 
+          INTEGER(C_INT), value ::  batch  !: 
+          INTEGER(C_INT), value ::  nx     !: 
+          INTEGER(C_INT), value ::  type   !: 
        END SUBROUTINE CUFFTPLAN1D
 
@@ -97,9 +104,9 @@
 
           USE ISO_C_BINDING
-          USE precision_kind
+          USE kinds
 
-          INTEGER(C_INT), VALUE ::  plan
-          COMPLEX(dpk), DEVICE  ::  idata(:,:,:)
-          REAL(dpk), DEVICE     ::  odata(:,:,:)
+          INTEGER(C_INT), VALUE ::  plan          !:
+          COMPLEX(dp), DEVICE   ::  idata(:,:,:)  !:
+          REAL(dp), DEVICE      ::  odata(:,:,:)  !:
 
        END SUBROUTINE CUFFTEXECZ2D
@@ -113,9 +120,10 @@
 
           USE ISO_C_BINDING
-          USE precision_kind
+          
+          USE kinds
 
-          INTEGER(C_INT), VALUE ::  plan
-          REAL(dpk), DEVICE     ::  idata(:,:,:)
-          COMPLEX(dpk), DEVICE  ::  odata(:,:,:)
+          INTEGER(C_INT), VALUE ::  plan          !:
+          REAL(dp), DEVICE      ::  idata(:,:,:)  !:
+          COMPLEX(dp), DEVICE   ::  odata(:,:,:)  !:
 
        END SUBROUTINE CUFFTEXECD2Z
@@ -131,6 +139,8 @@
 
        SUBROUTINE CUFFTdummy( dummy )
+       
+          USE kinds
 
-          REAL ::  dummy
+          REAL(wp) ::  dummy  !:
 
        END SUBROUTINE CUFFTdummy
Index: /palm/trunk/SOURCE/data_log.f90
===================================================================
--- /palm/trunk/SOURCE/data_log.f90	(revision 1319)
+++ /palm/trunk/SOURCE/data_log.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -41,12 +47,21 @@
 #if defined( __logging )
 
-    USE control_parameters
+    USE control_parameters,                                                    &
+        ONLY:  log_message, simulated_time
+        
+    USE kinds
+        
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER ::  i1, i2, j1, j2, k1, k2
+    INTEGER(iwp) ::  i1  !: 
+    INTEGER(iwp) ::  i2  !: 
+    INTEGER(iwp) ::  j1  !: 
+    INTEGER(iwp) ::  j2  !: 
+    INTEGER(iwp) ::  k1  !: 
+    INTEGER(iwp) ::  k2  !: 
 
-    REAL, DIMENSION(i1:i2,j1:j2,k1:k2) ::  array
+    REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2) ::  array  !: 
 
 
@@ -81,12 +96,19 @@
 #if defined( __logging )
 
-    USE control_parameters
+    USE control_parameters,                                                    &
+        ONLY:  log_message, simulated_time
+
+    USE kinds
+            
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER ::  i1, i2, j1, j2
+    INTEGER(iwp) ::  i1  !: 
+    INTEGER(iwp) ::  i2  !: 
+    INTEGER(iwp) ::  j1  !: 
+    INTEGER(iwp) ::  j2  !: 
 
-    REAL, DIMENSION(i1:i2,j1:j2) ::  array
+    REAL(wp), DIMENSION(i1:i2,j1:j2) ::  array  !: 
 
 
@@ -121,12 +143,19 @@
 #if defined( __logging )
 
-    USE control_parameters
+    USE control_parameters,                                                    &
+        ONLY:  log_message, simulated_time
+
+    USE kinds
+            
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER ::  i1, i2, j1, j2
+    INTEGER(iwp) ::  i1  !: 
+    INTEGER(iwp) ::  i2  !: 
+    INTEGER(iwp) ::  j1  !: 
+    INTEGER(iwp) ::  j2  !: 
 
-    INTEGER, DIMENSION(i1:i2,j1:j2) ::  array
+    INTEGER(iwp), DIMENSION(i1:i2,j1:j2) ::  array  !: 
 
 
Index: /palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_2d.f90	(revision 1319)
+++ /palm/trunk/SOURCE/data_output_2d.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -65,67 +71,4 @@
 ! +z0h
 !
-! 790 2011-11-29 03:11:20Z raasch
-! bugfix: calculation of 'pr' must depend on the particle weighting factor
-!
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt
-!
-! 759 2011-09-15 13:58:31Z raasch
-! Splitting of parallel I/O
-!
-! 729 2011-05-26 10:33:34Z heinze
-! Exchange ghost layers for p regardless of used pressure solver (except SOR).
-!
-! 691 2011-03-04 08:45:30Z maronga
-! Replaced simulated_time by time_since_reference_point
-!
-! 673 2011-01-18 16:19:48Z suehring
-! When using Multigrid or SOR solver an additional CALL exchange_horiz is 
-! is needed for pressure output.
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in loops and 
-! allocation of arrays local_2d and total_2d.
-! Calls of exchange_horiz are modiefied.
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 493 2010-03-01 08:30:24Z raasch
-! netCDF4 support (parallel output)
-!
-! 367 2009-08-25 08:35:52Z maronga
-! simulated_time in netCDF output replaced by time_since_reference_point.
-! Output of netCDF messages with aid of message handling routine.
-! Bugfix: averaging along z is not allowed for 2d quantities (e.g. u* and z0)
-! Output of messages replaced by message handling routine.
-! Output of user defined 2D (XY) arrays at z=nzb+1 is now possible
-! Bugfix: to_be_resorted => s_av for time-averaged scalars
-! Calculation of shf* and qsws* added.
-!
-! 215 2008-11-18 09:54:31Z raasch
-! Bugfix: no output of particle concentration and radius unless particles
-! have been started
-!
-! 96 2007-06-04 08:07:41Z raasch
-! Output of density and salinity
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Output of precipitation amount/rate and roughness length,
-! 2nd+3rd argument removed from exchange horiz
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.5  2006/08/22 13:50:29  raasch
-! xz and yz cross sections now up to nzt+1
-!
-! Revision 1.2  2006/02/23 10:19:22  raasch
-! Output of time-averaged data, output of averages along x, y, or z,
-! output of user-defined quantities,
-! section data are copied from local_pf to local_2d before they are output,
-! output of particle concentration and mean radius,
-! Former subroutine plot_2d renamed data_output_2d, pl2d.. renamed do2d..,
-! anz renamed ngp, ebene renamed section, pl2d_.._anz renamed do2d_.._n
-!
 ! Revision 1.1  1997/08/11 06:24:09  raasch
 ! Initial revision
@@ -140,34 +83,89 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
+    USE arrays_3d,                                                             &
+        ONLY:  dzw, e, nr, p, pt, q, qc, ql, ql_c, ql_v, ql_vp, qr, qsws,      &
+               rho, sa, shf, tend, ts, u, us, v, vpt, w, z0, z0h, zu, zw
+        
     USE averaging
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+        
+    USE cloud_parameters,                                                      &
+        ONLY:  hyrho, l_d_cp, precipitation_amount, precipitation_rate, prr,   &
+               pt_d_t
+               
+    USE control_parameters,                                                    &
+        ONLY:  cloud_physics, data_output_2d_on_each_pe, data_output_xy,       &
+               data_output_xz, data_output_yz, do2d,                           &
+               do2d_xy_last_time, do2d_xy_n, do2d_xy_time_count,               &
+               do2d_xz_last_time, do2d_xz_n, do2d_xz_time_count,               &
+               do2d_yz_last_time, do2d_yz_n, do2d_yz_time_count,               &
+               ibc_uv_b, icloud_scheme, io_blocks, io_group, iso2d_output,     &
+               message_string, netcdf_data_format, netcdf_output,              &
+               ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz, psolver, section,        &
+               simulated_time,  simulated_time_chr, time_since_reference_point
+        
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point 
+        
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+        
+    USE indices,                                                               &
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg,       &
+               nz, nzb, nzt
+               
+    USE kinds
+        
     USE netcdf_control
-    USE particle_attributes
+
+    USE particle_attributes,                                                   &
+        ONLY:  particle_advection_start, particles, prt_count,                 &
+               prt_start_index
+    
     USE pegrid
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=2)  ::  do2d_mode, mode
-    CHARACTER (LEN=4)  ::  grid
-    CHARACTER (LEN=25) ::  section_chr
-    CHARACTER (LEN=50) ::  rtext
-    INTEGER ::  av, ngp, file_id, i, if, is, iis, j, k, l, layer_xy, n, ns, &
-                psi, s, sender, &
-                ind(4)
-    LOGICAL ::  found, resorted, two_d
-    REAL    ::  mean_r, s_r3, s_r4
-    REAL, DIMENSION(:), ALLOCATABLE ::      level_z
-    REAL, DIMENSION(:,:), ALLOCATABLE ::    local_2d, local_2d_l
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  local_pf, local_2d_sections, &
-                                            local_2d_sections_l
+    CHARACTER (LEN=2)  ::  do2d_mode    !: 
+    CHARACTER (LEN=2)  ::  mode         !: 
+    CHARACTER (LEN=4)  ::  grid         !: 
+    CHARACTER (LEN=25) ::  section_chr  !: 
+    CHARACTER (LEN=50) ::  rtext        !: 
+    
+    INTEGER(iwp) ::  av        !: 
+    INTEGER(iwp) ::  ngp       !: 
+    INTEGER(iwp) ::  file_id   !: 
+    INTEGER(iwp) ::  i         !: 
+    INTEGER(iwp) ::  if        !: 
+    INTEGER(iwp) ::  is        !: 
+    INTEGER(iwp) ::  iis       !: 
+    INTEGER(iwp) ::  j         !: 
+    INTEGER(iwp) ::  k         !: 
+    INTEGER(iwp) ::  l         !: 
+    INTEGER(iwp) ::  layer_xy  !: 
+    INTEGER(iwp) ::  n         !: 
+    INTEGER(iwp) ::  ns        !: 
+    INTEGER(iwp) ::  psi       !: 
+    INTEGER(iwp) ::  s         !: 
+    INTEGER(iwp) ::  sender    !: 
+    INTEGER(iwp) ::  ind(4)    !: 
+    
+    LOGICAL ::  found          !: 
+    LOGICAL ::  resorted       !: 
+    LOGICAL ::  two_d          !: 
+    
+    REAL(wp) ::  mean_r         !:
+    REAL(wp) ::  s_r3           !:
+    REAL(wp) ::  s_r4           !:
+    
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::      level_z     !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::    local_2d    !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::    local_2d_l  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf    !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_2d_sections   !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_2d_sections_l !:
 #if defined( __parallel )
-    REAL, DIMENSION(:,:),   ALLOCATABLE ::  total_2d
-#endif
-    REAL, DIMENSION(:,:,:), POINTER ::  to_be_resorted
+    REAL(wp), DIMENSION(:,:),   ALLOCATABLE ::  total_2d  !:
+#endif
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !: 
 
     NAMELIST /LOCAL/  rtext
@@ -184,24 +182,24 @@
 !-- the given end time by the length of the given output interval.
     IF ( netcdf_data_format > 4 )  THEN
-       IF ( mode == 'xy'  .AND.  do2d_xy_time_count(av) + 1 > &
+       IF ( mode == 'xy'  .AND.  do2d_xy_time_count(av) + 1 >                  &
             ntdim_2d_xy(av) )  THEN
-          WRITE ( message_string, * ) 'Output of xy cross-sections is not ', &
-                          'given at t=', simulated_time, '&because the', & 
+          WRITE ( message_string, * ) 'Output of xy cross-sections is not ',   &
+                          'given at t=', simulated_time, '&because the',       & 
                           ' maximum number of output time levels is exceeded.'
           CALL message( 'data_output_2d', 'PA0384', 0, 1, 0, 6, 0 )          
           RETURN
        ENDIF
-       IF ( mode == 'xz'  .AND.  do2d_xz_time_count(av) + 1 > &
+       IF ( mode == 'xz'  .AND.  do2d_xz_time_count(av) + 1 >                  &
             ntdim_2d_xz(av) )  THEN
-          WRITE ( message_string, * ) 'Output of xz cross-sections is not ',  &
-                          'given at t=', simulated_time, '&because the', & 
+          WRITE ( message_string, * ) 'Output of xz cross-sections is not ',   &
+                          'given at t=', simulated_time, '&because the',       & 
                           ' maximum number of output time levels is exceeded.'
           CALL message( 'data_output_2d', 'PA0385', 0, 1, 0, 6, 0 )          
           RETURN
        ENDIF
-       IF ( mode == 'yz'  .AND.  do2d_yz_time_count(av) + 1 > &
+       IF ( mode == 'yz'  .AND.  do2d_yz_time_count(av) + 1 >                  &
             ntdim_2d_yz(av) )  THEN
-          WRITE ( message_string, * ) 'Output of yz cross-sections is not ', &
-                          'given at t=', simulated_time, '&because the', & 
+          WRITE ( message_string, * ) 'Output of yz cross-sections is not ',   &
+                          'given at t=', simulated_time, '&because the',       & 
                           ' maximum number of output time levels is exceeded.'
           CALL message( 'data_output_2d', 'PA0386', 0, 1, 0, 6, 0 )          
@@ -363,5 +361,5 @@
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = SUM( ql(nzb:nzt,j,i) * &
+                         local_pf(i,j,nzb+1) = SUM( ql(nzb:nzt,j,i) *          &
                                                     dzw(1:nzt+1) )
                       ENDDO
@@ -427,7 +425,7 @@
                                s_r4 = 0.0
                                DO  n = psi, psi+prt_count(k,j,i)-1
-                                  s_r3 = s_r3 + particles(n)%radius**3 * &
+                                  s_r3 = s_r3 + particles(n)%radius**3 *       &
                                                 particles(n)%weight_factor
-                                  s_r4 = s_r4 + particles(n)%radius**4 * &
+                                  s_r4 = s_r4 + particles(n)%radius**4 *       &
                                                 particles(n)%weight_factor
                                ENDDO
@@ -499,5 +497,6 @@
                       DO  i = nxlg, nxrg
                          DO  j = nysg, nyng
-                            local_pf(i,j,nzb+1) = prr_av(nzb+1,j,i) * hyrho(nzb+1)
+                            local_pf(i,j,nzb+1) = prr_av(nzb+1,j,i) *          &
+                                                  hyrho(nzb+1)
                          ENDDO
                       ENDDO
@@ -539,6 +538,6 @@
                       DO  j = nysg, nyng
                             DO  k = nzb, nzt+1
-                               local_pf(i,j,k) = pt(k,j,i) + l_d_cp *    &
-                                                             pt_d_t(k) * &
+                               local_pf(i,j,k) = pt(k,j,i) + l_d_cp *          &
+                                                             pt_d_t(k) *       &
                                                              ql(k,j,i)
                             ENDDO
@@ -600,6 +599,6 @@
                                psi = prt_start_index(k,j,i)
                                DO  n = psi, psi+prt_count(k,j,i)-1
-                                  tend(k,j,i) =  tend(k,j,i) + &
-                                                 particles(n)%weight_factor / &
+                                  tend(k,j,i) =  tend(k,j,i) +                 &
+                                                 particles(n)%weight_factor /  &
                                                  prt_count(k,j,i)
                                ENDDO
@@ -824,5 +823,5 @@
 !
 !--             User defined quantity
-                CALL user_data_output_2d( av, do2d(av,if), found, grid, &
+                CALL user_data_output_2d( av, do2d(av,if), found, grid,        &
                                           local_pf, two_d )
                 resorted = .TRUE.
@@ -837,5 +836,5 @@
 
                 IF ( .NOT. found )  THEN
-                   message_string = 'no output provided for: ' //    &
+                   message_string = 'no output provided for: ' //              &
                                     TRIM( do2d(av,if) )
                    CALL message( 'data_output_2d', 'PA0181', 0, 0, 0, 6, 0 )
@@ -881,6 +880,6 @@
                       do2d_xy_last_time(av)  = simulated_time
                       IF ( myid == 0 )  THEN
-                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND. &
-                              netcdf_output )  .OR.  netcdf_data_format > 4 ) &
+                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.         &
+                              netcdf_output )  .OR.  netcdf_data_format > 4 )  &
                          THEN
 #if defined( __netcdf )
@@ -947,5 +946,5 @@
 #if defined( __netcdf )
                          IF ( netcdf_output  .AND.  myid == 0 )  THEN
-                            WRITE ( 21 )  time_since_reference_point, &
+                            WRITE ( 21 )  time_since_reference_point,          &
                                           do2d_xy_time_count(av), av
                          ENDIF
@@ -981,12 +980,12 @@
 !--                            Index limits are received in arbitrary order from
 !--                            the PEs.
-                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,    &
-                                              MPI_ANY_SOURCE, 0, comm2d, &
+                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,          &
+                                              MPI_ANY_SOURCE, 0, comm2d,       &
                                               status, ierr )
                                sender = status(MPI_SOURCE)
                                DEALLOCATE( local_2d )
                                ALLOCATE( local_2d(ind(1):ind(2),ind(3):ind(4)) )
-                               CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp,  &
-                                              MPI_REAL, sender, 1, comm2d,   &
+                               CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp,    &
+                                              MPI_REAL, sender, 1, comm2d,     &
                                               status, ierr )
                                total_2d(ind(1):ind(2),ind(3):ind(4)) = local_2d
@@ -1026,9 +1025,9 @@
                             ind(1) = nxlg; ind(2) = nxrg
                             ind(3) = nysg; ind(4) = nyng
-                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, &
+                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0,       &
                                            comm2d, ierr )
 !
 !--                         Send data to PE0
-                            CALL MPI_SEND( local_2d(nxlg,nysg), ngp, &
+                            CALL MPI_SEND( local_2d(nxlg,nysg), ngp,           &
                                            MPI_REAL, 0, 1, comm2d, ierr )
                          ENDIF
@@ -1076,10 +1075,10 @@
                       ENDIF
                       IF ( av == 0 )  THEN
-                         rtext = TRIM( do2d(av,if) ) // '  t = ' //    &
-                                 TRIM( simulated_time_chr ) // '  ' // &
+                         rtext = TRIM( do2d(av,if) ) // '  t = ' //            &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ELSE
-                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' // &
-                                 TRIM( simulated_time_chr ) // '  ' //       &
+                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' //   &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ENDIF
@@ -1103,6 +1102,6 @@
                       do2d_xz_last_time(av)  = simulated_time
                       IF ( myid == 0 )  THEN
-                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.        &
-                              netcdf_output )  .OR.  netcdf_data_format > 4 ) &
+                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.         &
+                              netcdf_output )  .OR.  netcdf_data_format > 4 )  &
                          THEN
 #if defined( __netcdf )
@@ -1130,5 +1129,5 @@
                          DO  j = nys, nyn
                             DO  i = nxlg, nxrg
-                               local_2d_l(i,k) = local_2d_l(i,k) + &
+                               local_2d_l(i,k) = local_2d_l(i,k) +             &
                                                  local_pf(i,j,k)
                             ENDDO
@@ -1139,6 +1138,6 @@
 !--                   Now do the averaging over all PEs along y
                       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-                      CALL MPI_ALLREDUCE( local_2d_l(nxlg,nzb),              &
-                                          local_2d(nxlg,nzb), ngp, MPI_REAL, &
+                      CALL MPI_ALLREDUCE( local_2d_l(nxlg,nzb),                &
+                                          local_2d(nxlg,nzb), ngp, MPI_REAL,   &
                                           MPI_SUM, comm1dy, ierr )
 #else
@@ -1167,6 +1166,6 @@
 !--                   sections reside. Cross sections averaged along y are
 !--                   output on the respective first PE along y (myidy=0).
-                      IF ( ( section(is,s) >= nys  .AND.  &
-                             section(is,s) <= nyn )  .OR.  &
+                      IF ( ( section(is,s) >= nys  .AND.                       &
+                             section(is,s) <= nyn )  .OR.                      &
                            ( section(is,s) == -1  .AND.  myidy == 0 ) )  THEN
 #if defined( __netcdf )
@@ -1192,5 +1191,5 @@
 #if defined( __netcdf )
                          IF ( netcdf_output  .AND.  myid == 0 )  THEN
-                            WRITE ( 22 )  time_since_reference_point, &
+                            WRITE ( 22 )  time_since_reference_point,          &
                                           do2d_xz_time_count(av), av
                          ENDIF
@@ -1198,8 +1197,8 @@
                          DO  i = 0, io_blocks-1
                             IF ( i == io_group )  THEN
-                               IF ( ( section(is,s) >= nys  .AND.   &
-                                      section(is,s) <= nyn )  .OR.  &
-                                    ( section(is,s) == -1  .AND.    &
-                                      nys-1 == -1 ) )               &
+                               IF ( ( section(is,s) >= nys  .AND.              &
+                                      section(is,s) <= nyn )  .OR.             &
+                                    ( section(is,s) == -1  .AND.               &
+                                      nys-1 == -1 ) )                          &
                                THEN
                                   WRITE (22)  nxlg, nxrg, nzb, nzt+1
@@ -1239,6 +1238,6 @@
 !--                            Index limits are received in arbitrary order from
 !--                            the PEs.
-                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,     &
-                                              MPI_ANY_SOURCE, 0, comm2d,  &
+                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,          &
+                                              MPI_ANY_SOURCE, 0, comm2d,       &
                                               status, ierr )
 !
@@ -1247,10 +1246,10 @@
                                   sender = status(MPI_SOURCE)
                                   DEALLOCATE( local_2d )
-                                  ALLOCATE( local_2d(ind(1):ind(2), &
+                                  ALLOCATE( local_2d(ind(1):ind(2),            &
                                                      ind(3):ind(4)) )
                                   CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, &
                                                  MPI_REAL, sender, 1, comm2d,  &
                                                  status, ierr )
-                                  total_2d(ind(1):ind(2),ind(3):ind(4)) = &
+                                  total_2d(ind(1):ind(2),ind(3):ind(4)) =      &
                                                                         local_2d
                                ENDIF
@@ -1291,10 +1290,10 @@
                                ind(3) = -9999; ind(4) = -9999
                             ENDIF
-                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, &
+                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0,       &
                                            comm2d, ierr )
 !
 !--                         If applicable, send data to PE0.
                             IF ( ind(1) /= -9999 )  THEN
-                               CALL MPI_SEND( local_2d(nxlg,nzb), ngp, &
+                               CALL MPI_SEND( local_2d(nxlg,nzb), ngp,         &
                                               MPI_REAL, 0, 1, comm2d, ierr )
                             ENDIF
@@ -1335,10 +1334,10 @@
                       ENDIF
                       IF ( av == 0 )  THEN
-                         rtext = TRIM( do2d(av,if) ) // '  t = ' //    &
-                                 TRIM( simulated_time_chr ) // '  ' // &
+                         rtext = TRIM( do2d(av,if) ) // '  t = ' //            &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ELSE
-                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' // &
-                                 TRIM( simulated_time_chr ) // '  ' //       &
+                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' //   &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ENDIF
@@ -1355,6 +1354,6 @@
                       do2d_yz_last_time(av)  = simulated_time
                       IF ( myid == 0 )  THEN
-                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.        &
-                              netcdf_output )  .OR.  netcdf_data_format > 4 ) &
+                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.         &
+                              netcdf_output )  .OR.  netcdf_data_format > 4 )  &
                          THEN
 #if defined( __netcdf )
@@ -1382,5 +1381,5 @@
                          DO  j = nysg, nyng
                             DO  i = nxl, nxr
-                               local_2d_l(j,k) = local_2d_l(j,k) + &
+                               local_2d_l(j,k) = local_2d_l(j,k) +             &
                                                  local_pf(i,j,k)
                             ENDDO
@@ -1391,6 +1390,6 @@
 !--                   Now do the averaging over all PEs along x
                       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-                      CALL MPI_ALLREDUCE( local_2d_l(nysg,nzb),              &
-                                          local_2d(nysg,nzb), ngp, MPI_REAL, &
+                      CALL MPI_ALLREDUCE( local_2d_l(nysg,nzb),                &
+                                          local_2d(nysg,nzb), ngp, MPI_REAL,   &
                                           MPI_SUM, comm1dx, ierr )
 #else
@@ -1419,6 +1418,6 @@
 !--                   sections reside. Cross sections averaged along x are
 !--                   output on the respective first PE along x (myidx=0).
-                      IF ( ( section(is,s) >= nxl  .AND.  &
-                             section(is,s) <= nxr )  .OR.  &
+                      IF ( ( section(is,s) >= nxl  .AND.                       &
+                             section(is,s) <= nxr )  .OR.                      &
                            ( section(is,s) == -1  .AND.  myidx == 0 ) )  THEN
 #if defined( __netcdf )
@@ -1444,5 +1443,5 @@
 #if defined( __netcdf )
                          IF ( netcdf_output  .AND.  myid == 0 )  THEN
-                            WRITE ( 23 )  time_since_reference_point, &
+                            WRITE ( 23 )  time_since_reference_point,          &
                                           do2d_yz_time_count(av), av
                          ENDIF
@@ -1450,8 +1449,8 @@
                          DO  i = 0, io_blocks-1
                             IF ( i == io_group )  THEN
-                               IF ( ( section(is,s) >= nxl  .AND.   &
-                                      section(is,s) <= nxr )  .OR.  &
-                                    ( section(is,s) == -1  .AND.    &
-                                      nxl-1 == -1 ) )               &
+                               IF ( ( section(is,s) >= nxl  .AND.              &
+                                      section(is,s) <= nxr )  .OR.             &
+                                    ( section(is,s) == -1  .AND.               &
+                                      nxl-1 == -1 ) )                          &
                                THEN
                                   WRITE (23)  nysg, nyng, nzb, nzt+1
@@ -1491,6 +1490,6 @@
 !--                            Index limits are received in arbitrary order from
 !--                            the PEs.
-                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,     &
-                                              MPI_ANY_SOURCE, 0, comm2d,  &
+                               CALL MPI_RECV( ind(1), 4, MPI_INTEGER,          &
+                                              MPI_ANY_SOURCE, 0, comm2d,       &
                                               status, ierr )
 !
@@ -1499,10 +1498,10 @@
                                   sender = status(MPI_SOURCE)
                                   DEALLOCATE( local_2d )
-                                  ALLOCATE( local_2d(ind(1):ind(2), &
+                                  ALLOCATE( local_2d(ind(1):ind(2),            &
                                                      ind(3):ind(4)) )
                                   CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, &
                                                  MPI_REAL, sender, 1, comm2d,  &
                                                  status, ierr )
-                                  total_2d(ind(1):ind(2),ind(3):ind(4)) = &
+                                  total_2d(ind(1):ind(2),ind(3):ind(4)) =      &
                                                                         local_2d
                                ENDIF
@@ -1543,10 +1542,10 @@
                                ind(3) = -9999; ind(4) = -9999
                             ENDIF
-                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, &
+                            CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0,       &
                                            comm2d, ierr )
 !
 !--                         If applicable, send data to PE0.
                             IF ( ind(1) /= -9999 )  THEN
-                               CALL MPI_SEND( local_2d(nysg,nzb), ngp, &
+                               CALL MPI_SEND( local_2d(nysg,nzb), ngp,         &
                                               MPI_REAL, 0, 1, comm2d, ierr )
                             ENDIF
@@ -1587,10 +1586,10 @@
                       ENDIF
                       IF ( av == 0 )  THEN
-                         rtext = TRIM( do2d(av,if) ) // '  t = ' //    &
-                                 TRIM( simulated_time_chr ) // '  ' // &
+                         rtext = TRIM( do2d(av,if) ) // '  t = ' //            &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ELSE
-                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' // &
-                                 TRIM( simulated_time_chr ) // '  ' //       &
+                         rtext = TRIM( do2d(av,if) ) // '  averaged t = ' //   &
+                                 TRIM( simulated_time_chr ) // '  ' //         &
                                  TRIM( section_chr )
                       ENDIF
Index: /palm/trunk/SOURCE/data_output_3d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_3d.f90	(revision 1319)
+++ /palm/trunk/SOURCE/data_output_3d.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -59,60 +65,4 @@
 ! Bugfix: missing calculation of ql_vp added
 !
-! 790 2011-11-29 03:11:20Z raasch
-! bugfix: calculation of 'pr' must depend on the particle weighting factor,
-! nzt+1 replaced by nz_do3d for 'pr'
-!
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt
-!
-! 759 2011-09-15 13:58:31Z raasch
-! Splitting of parallel I/O
-!
-! 727 2011-04-20 20:05:25Z suehring
-! Exchange ghost layers also for p_av.
-!
-! 725 2011-04-11 09:37:01Z suehring
-! Exchange ghost layers for p regardless of used pressure solver (except SOR).
-!
-! 691 2011-03-04 08:45:30Z maronga
-! Replaced simulated_time by time_since_reference_point
-!
-! 673 2011-01-18 16:19:48Z suehring 
-! When using Multigrid or SOR solver an additional CALL exchange_horiz is 
-! is needed for pressure output.
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in loops and 
-! allocation of arrays.  Calls of exchange_horiz are modified.
-! Skip-value skip_do_avs changed to a dynamic adaption of ghost points.
-!
-! 646 2010-12-15 13:03:52Z raasch
-! bugfix: missing define statements for netcdf added
-!
-! 493 2010-03-01 08:30:24Z raasch
-! netCDF4 support (parallel output)
-!
-! 355 2009-07-17 01:03:01Z letzel
-! simulated_time in netCDF output replaced by time_since_reference_point.
-! Output of netCDF messages with aid of message handling routine.
-! Output of messages replaced by message handling routine.
-! Bugfix: to_be_resorted => s_av for time-averaged scalars
-!
-! 96 2007-06-04 08:07:41Z raasch
-! Output of density and salinity
-!
-! 75 2007-03-22 09:54:05Z raasch
-! 2nd+3rd argument removed from exchange horiz
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.3  2006/06/02 15:18:59  raasch
-! +argument "found", -argument grid in call of routine user_data_output_3d
-!
-! Revision 1.2  2006/02/23 10:23:07  raasch
-! Former subroutine plot_3d renamed data_output_3d, pl.. renamed do..,
-! .._anz renamed .._n,
-! output extended to (almost) all quantities, output of user-defined quantities
-!
 ! Revision 1.1  1997/09/03 06:29:36  raasch
 ! Initial revision
@@ -124,28 +74,60 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
+    USE arrays_3d,                                                             &
+        ONLY:  e, nr, p, pt, q, qc, ql, ql_c, ql_v, qr, rho, sa, tend, u, v,   &
+               vpt, w
+        
     USE averaging
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE indices
+        
+    USE cloud_parameters,                                                      &
+        ONLY:  l_d_cp, prr, pt_d_t
+        
+    USE control_parameters,                                                    &
+        ONLY:  avs_data_file,avs_output, cloud_physics, do3d, do3d_avs_n,      &
+               do3d_compress, do3d_no, do3d_time_count, io_blocks, io_group,   &
+               message_string, netcdf_output, netcdf_data_format, ntdim_3d,    &
+               nz_do3d, plot_3d_precision, psolver, simulated_time,            &
+               simulated_time_chr, skip_do_avs, time_since_reference_point
+        
+    USE cpulog,                                                                &
+        ONLY:  log_point, cpu_log
+        
+    USE indices,                                                               &
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzt,  &
+               nzb
+        
+    USE kinds
+    
     USE netcdf_control
-    USE particle_attributes
+        
+    USE particle_attributes,                                                   &
+        ONLY:  particles, prt_count, prt_start_index
+        
     USE pegrid
-    USE precision_kind
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=9) ::  simulated_time_mod
-
-    INTEGER           ::  av, i, if, j, k, n, pos, prec, psi
-
-    LOGICAL           ::  found, resorted
-
-    REAL              ::  mean_r, s_r3, s_r4
-
-    REAL(spk), DIMENSION(:,:,:), ALLOCATABLE  ::  local_pf
-
-    REAL, DIMENSION(:,:,:), POINTER ::  to_be_resorted
+    CHARACTER (LEN=9) ::  simulated_time_mod  !: 
+
+    INTEGER(iwp) ::  av        !: 
+    INTEGER(iwp) ::  i         !: 
+    INTEGER(iwp) ::  if        !: 
+    INTEGER(iwp) ::  j         !: 
+    INTEGER(iwp) ::  k         !: 
+    INTEGER(iwp) ::  n         !: 
+    INTEGER(iwp) ::  pos       !: 
+    INTEGER(iwp) ::  prec      !: 
+    INTEGER(iwp) ::  psi       !: 
+
+    LOGICAL      ::  found     !: 
+    LOGICAL      ::  resorted  !: 
+
+    REAL(wp)     ::  mean_r    !: 
+    REAL(wp)     ::  s_r3      !: 
+    REAL(wp)     ::  s_r4      !: 
+
+    REAL(sp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf  !:
+
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !: 
 
 !
@@ -202,7 +184,7 @@
     IF ( myid == 0 )  THEN
        IF ( netcdf_output )  THEN
-          nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_time_3d(av), &
-                                  (/ time_since_reference_point /),  &
-                                  start = (/ do3d_time_count(av) /), &
+          nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_time_3d(av),           &
+                                  (/ time_since_reference_point /),            &
+                                  start = (/ do3d_time_count(av) /),           &
                                   count = (/ 1 /) )
           CALL handle_netcdf_error( 'data_output_3d', 376 )
@@ -288,7 +270,7 @@
                          s_r4 = 0.0
                          DO  n = psi, psi+prt_count(k,j,i)-1
-                         s_r3 = s_r3 + particles(n)%radius**3 * &
+                         s_r3 = s_r3 + particles(n)%radius**3 *                &
                                        particles(n)%weight_factor
-                         s_r4 = s_r4 + particles(n)%radius**4 * &
+                         s_r4 = s_r4 + particles(n)%radius**4 *                &
                                        particles(n)%weight_factor
                          ENDDO
@@ -346,6 +328,6 @@
                       DO  j = nysg, nyng
                          DO  k = nzb, nz_do3d
-                            local_pf(i,j,k) = pt(k,j,i) + l_d_cp *    &
-                                                          pt_d_t(k) * &
+                            local_pf(i,j,k) = pt(k,j,i) + l_d_cp *             &
+                                                          pt_d_t(k) *          &
                                                           ql(k,j,i)
                          ENDDO
@@ -400,6 +382,6 @@
                          psi = prt_start_index(k,j,i)
                          DO  n = psi, psi+prt_count(k,j,i)-1
-                            tend(k,j,i) = tend(k,j,i) + &
-                                          particles(n)%weight_factor / &
+                            tend(k,j,i) = tend(k,j,i) +                        &
+                                          particles(n)%weight_factor /         &
                                           prt_count(k,j,i)
                          ENDDO
@@ -494,10 +476,10 @@
 !
 !--          User defined quantity
-             CALL user_data_output_3d( av, do3d(av,if), found, local_pf, &
+             CALL user_data_output_3d( av, do3d(av,if), found, local_pf,       &
                                        nz_do3d )
              resorted = .TRUE.
 
              IF ( .NOT. found )  THEN
-                message_string =  'no output available for: ' //   &
+                message_string =  'no output available for: ' //               &
                                   TRIM( do3d(av,if) )
                 CALL message( 'data_output_3d', 'PA0182', 0, 0, 0, 6, 0 )
@@ -532,10 +514,10 @@
 
           IF ( av == 0 )  THEN
-             WRITE ( 33, 3300 )  do3d_avs_n, TRIM( avs_data_file ), &
-                                 skip_do_avs, TRIM( do3d(av,if) ), &
+             WRITE ( 33, 3300 )  do3d_avs_n, TRIM( avs_data_file ),            &
+                                 skip_do_avs, TRIM( do3d(av,if) ),             &
                                  TRIM( simulated_time_mod )
           ELSE
-             WRITE ( 33, 3300 )  do3d_avs_n, TRIM( avs_data_file ), &
-                                 skip_do_avs, TRIM( do3d(av,if) ) // &
+             WRITE ( 33, 3300 )  do3d_avs_n, TRIM( avs_data_file ),            &
+                                 skip_do_avs, TRIM( do3d(av,if) ) //           &
                                  ' averaged', TRIM( simulated_time_mod )
           ENDIF
@@ -543,5 +525,5 @@
 !--       Determine the Skip-value for the next array. Record end and start 
 !--       require 4 byte each.
-          skip_do_avs = skip_do_avs + ( ( ( nx+2*nbgp ) * ( ny+2*nbgp ) * &
+          skip_do_avs = skip_do_avs + ( ( ( nx+2*nbgp ) * ( ny+2*nbgp ) *      &
                                           ( nz_do3d+1 ) ) * 4 + 8 )
        ENDIF
@@ -553,5 +535,5 @@
 !--       Compression, output of compression information on FLD-file and output
 !--       of compressed data.
-          CALL write_compressed( local_pf, 30, 33, myid, nxl, nxr, nyn, nys, &
+          CALL write_compressed( local_pf, 30, 33, myid, nxl, nxr, nyn, nys,   &
                                  nzb, nz_do3d, prec, nbgp )
        ELSE
@@ -586,22 +568,22 @@
 !--             boundaries of the total domain.
                 IF ( nxr == nx  .AND.  nyn /= ny )  THEN
-                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), &
-                                     local_pf(nxl:nxr+1,nys:nyn,nzb:nz_do3d), &
-                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), &
+                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+                                     local_pf(nxl:nxr+1,nys:nyn,nzb:nz_do3d),  &
+                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /),  &
                       count = (/ nxr-nxl+2, nyn-nys+1, nz_do3d-nzb+1, 1 /) )
                 ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
-                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), &
-                                     local_pf(nxl:nxr,nys:nyn+1,nzb:nz_do3d), &
-                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), &
+                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+                                     local_pf(nxl:nxr,nys:nyn+1,nzb:nz_do3d),  &
+                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /),  &
                       count = (/ nxr-nxl+1, nyn-nys+2, nz_do3d-nzb+1, 1 /) )
                 ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
-                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), &
-                                   local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d), &
-                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), &
+                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+                                   local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d),  &
+                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /),  &
                       count = (/ nxr-nxl+2, nyn-nys+2, nz_do3d-nzb+1, 1 /) )
                 ELSE
-                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), &
-                                       local_pf(nxl:nxr,nys:nyn,nzb:nz_do3d), &
-                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), &
+                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+                                       local_pf(nxl:nxr,nys:nyn,nzb:nz_do3d),  &
+                      start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /),  &
                       count = (/ nxr-nxl+1, nyn-nys+1, nz_do3d-nzb+1, 1 /) )
                 ENDIF
@@ -617,7 +599,7 @@
           IF ( netcdf_output )  THEN
 
-             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),    &
-                               local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d),  &
-                               start = (/ 1, 1, 1, do3d_time_count(av) /), &
+             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),        &
+                               local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d),      &
+                               start = (/ 1, 1, 1, do3d_time_count(av) /),     &
                                count = (/ nx+2, ny+2, nz_do3d-nzb+1, 1 /) )
              CALL handle_netcdf_error( 'data_output_3d', 446 )
@@ -641,5 +623,5 @@
 !
 !-- Formats.
-3300 FORMAT ('variable ',I4,'  file=',A,'  filetype=unformatted  skip=',I12/ &
+3300 FORMAT ('variable ',I4,'  file=',A,'  filetype=unformatted  skip=',I12/   &
              'label = ',A,A)
 
Index: /palm/trunk/SOURCE/data_output_dvrp.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_dvrp.f90	(revision 1319)
+++ /palm/trunk/SOURCE/data_output_dvrp.f90	(revision 1320)
@@ -1,2 +1,4 @@
+ MODULE dvrp_color
+
 !--------------------------------------------------------------------------------!
 ! This file is part of PALM.
@@ -18,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -32,32 +40,4 @@
 ! 828 2012-02-21 12:00:36Z raasch
 ! particle feature color renamed class
-!
-! 287 2009-04-09 08:59:36Z raasch
-! Clipping of dvr-output implemented, using a default colourtable for
-! particles,
-! output of messages replaced by message handling routine.
-!
-! 210 2008-11-06 08:54:02Z raasch
-! DVRP arguments changed to single precision, mode pathlines added
-!
-! 130 2007-11-13 14:08:40Z letzel
-! allow two instead of one digit to specify isosurface and slicer variables
-! for unknown variables (CASE DEFAULT) call new subroutine 
-! user_data_output_dvrp
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Preprocessor strings for different linux clusters changed to "lc",
-! routine local_flush is used for buffer flushing
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Particles-package is now part of the default code,
-! moisture renamed humidity
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.13  2006/02/23 10:25:12  raasch
-! Former routine plot_dvrp renamed data_output_dvrp,
-! Only a fraction of the particles may have a tail,
-! pl.. replaced by do.., %size renamed %dvrp_psize
 !
 ! Revision 1.1  2000/04/27 06:27:17  raasch
@@ -70,7 +50,7 @@
 !------------------------------------------------------------------------------!
 
- MODULE dvrp_color
-
     USE dvrp_variables
+    
+    USE kinds
 
     IMPLICIT NONE
@@ -80,16 +60,16 @@
     SUBROUTINE color_dvrp( value, color )
 
-       REAL, INTENT(IN)  ::  value
-       REAL, INTENT(OUT) ::  color(4)
-
-       REAL              ::  scale
-
-       scale = ( value - slicer_range_limits_dvrp(1,islice_dvrp) ) / &
-               ( slicer_range_limits_dvrp(2,islice_dvrp) -           &
+       REAL(wp), INTENT(IN)  ::  value    !: 
+       REAL(wp), INTENT(OUT) ::  color(4) !: 
+
+       REAL(wp)              ::  scale    !: 
+
+       scale = ( value - slicer_range_limits_dvrp(1,islice_dvrp) ) /           &
+               ( slicer_range_limits_dvrp(2,islice_dvrp) -                     &
                  slicer_range_limits_dvrp(1,islice_dvrp) )
 
        scale = MODULO( 180.0 + 180.0 * scale, 360.0 )
 
-       color = (/ scale, 0.5, 1.0, 0.0 /)
+       color = (/ scale, 0.5_wp, 1.0_wp, 0.0_wp /)
 
     END SUBROUTINE color_dvrp
@@ -102,33 +82,90 @@
 #if defined( __dvrp_graphics )
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE constants
-    USE control_parameters
-    USE cpulog
+    USE arrays_3d,                                                             &
+        ONLY:  p, pt, q, ql, ts, u, us, v, w, zu
+        
+    USE cloud_parameters,                                                      &
+        ONLY:  l_d_cp, pt_d_t
+        
+    USE constants,                                                             &
+        ONLY:  pi
+        
+    USE control_parameters,                                                    &
+        ONLY:  cloud_droplets, cloud_physics, do2d, do3d, humidity, ibc_uv_b,  &
+               message_string, nz_do3d, passive_scalar, simulated_time,        &
+               threshold
+        
+    USE cpulog,                                                                &
+        ONLY:  log_point, log_point_s, cpu_log
+        
     USE DVRP
+    
     USE dvrp_color
+        
     USE dvrp_variables
-    USE grid_variables
-    USE indices
-    USE particle_attributes
+        
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+        
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys, nzb
+        
+    USE kinds
+    
+    USE particle_attributes,                                                   &
+        ONLY:  maximum_number_of_tailpoints, number_of_particles,              &
+               number_of_tails, particle_advection, particle_advection_start,  &
+               particle_tail_coordinates, particles, uniform_particles,        &
+               use_particle_tails
+        
     USE pegrid
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=2) ::  section_chr
-    CHARACTER (LEN=6) ::  output_variable
-    INTEGER ::  c_mode, c_size_x, c_size_y, c_size_z, dvrp_nop, dvrp_not,     &
-                gradient_normals, i, ip, j, jp, k, l, m, n, n_isosurface,     &
-                n_slicer, nn, section_mode, vn
-    INTEGER, DIMENSION(:), ALLOCATABLE ::  p_c, p_t
-
-    LOGICAL, DIMENSION(:), ALLOCATABLE ::  dvrp_mask
-
-    REAL(4) ::  slicer_position, tmp_alpha, tmp_alpha_w, tmp_b, tmp_c_alpha, &
-                tmp_g, tmp_norm, tmp_pos, tmp_r, tmp_t, tmp_th
-    REAL(4), DIMENSION(:),     ALLOCATABLE   ::  psize, p_x, p_y, p_z
-    REAL(4), DIMENSION(:,:,:), ALLOCATABLE   ::  local_pf
-    REAL(4), DIMENSION(:,:,:,:), ALLOCATABLE ::  local_pfi
+    CHARACTER (LEN=2) ::  section_chr      !: 
+    CHARACTER (LEN=6) ::  output_variable  !: 
+    
+    INTEGER(iwp) ::  c_mode           !:  
+    INTEGER(iwp) ::  c_size_x         !: 
+    INTEGER(iwp) ::  c_size_y         !: 
+    INTEGER(iwp) ::  c_size_z         !: 
+    INTEGER(iwp) ::  dvrp_nop         !: 
+    INTEGER(iwp) ::  dvrp_not         !: 
+    INTEGER(iwp) ::  gradient_normals !: 
+    INTEGER(iwp) ::  i                !: 
+    INTEGER(iwp) ::  ip               !: 
+    INTEGER(iwp) ::  j                !: 
+    INTEGER(iwp) ::  jp               !: 
+    INTEGER(iwp) ::  k                !: 
+    INTEGER(iwp) ::  l                !: 
+    INTEGER(iwp) ::  m                !: 
+    INTEGER(iwp) ::  n                !: 
+    INTEGER(iwp) ::  n_isosurface     !: 
+    INTEGER(iwp) ::  n_slicer         !: 
+    INTEGER(iwp) ::  nn               !: 
+    INTEGER(iwp) ::  section_mode     !: 
+    INTEGER(iwp) ::  vn               !: 
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  p_c  !: 
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  p_t  !: 
+
+    LOGICAL, DIMENSION(:), ALLOCATABLE ::  dvrp_mask  !: 
+
+    REAL(sp) ::  slicer_position  !: 
+    REAL(sp) ::  tmp_alpha        !: 
+    REAL(sp) ::  tmp_alpha_w      !: 
+    REAL(sp) ::  tmp_b            !: 
+    REAL(sp) ::  tmp_c_alpha      !: 
+    REAL(sp) ::  tmp_g            !: 
+    REAL(sp) ::  tmp_norm         !: 
+    REAL(sp) ::  tmp_pos          !: 
+    REAL(sp) ::  tmp_r            !: 
+    REAL(sp) ::  tmp_t            !: 
+    REAL(sp) ::  tmp_th           !: 
+    REAL(sp), DIMENSION(:),     ALLOCATABLE   ::  psize  !: 
+    REAL(sp), DIMENSION(:),     ALLOCATABLE   ::  p_x    !: 
+    REAL(sp), DIMENSION(:),     ALLOCATABLE   ::  p_y    !: 
+    REAL(sp), DIMENSION(:),     ALLOCATABLE   ::  p_z    !: 
+    REAL(sp), DIMENSION(:,:,:), ALLOCATABLE   ::  local_pf  !: 
+    REAL(sp), DIMENSION(:,:,:,:), ALLOCATABLE ::  local_pfi !: 
 
 
Index: /palm/trunk/SOURCE/data_output_mask.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_mask.f90	(revision 1319)
+++ /palm/trunk/SOURCE/data_output_mask.f90	(revision 1320)
@@ -42,20 +42,4 @@
 ! Bugfix: calculation of pr must depend on the particle weighting factor,
 ! missing calculation of ql_vp added
-!
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Calls of exchange_horiz are modified.
-!
-! 564 2010-09-30 13:18:59Z helmke
-! start number of mask output files changed to 201, netcdf message identifiers
-! of masked output changed, palm message identifiers of masked output changed 
-!
-! 493 2010-03-01 08:30:24Z raasch
-! netcdf_format_mask* and format_parallel_io replaced by netcdf_data_format
-!
-! 475 2010-02-04 02:26:16Z raasch
-! Bugfix in serial branch: arguments from array local_pf removed in N90_PUT_VAR
 !
 ! 410 2009-12-04 17:05:40Z letzel
@@ -68,27 +52,63 @@
 
 #if defined( __netcdf )
-    USE arrays_3d
-    USE averaging
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  e, p, pt, q, ql, ql_c, ql_v, rho, sa, tend, u, v, vpt, w
+    
+    USE averaging,                                                             &
+        ONLY:  e_av, lpt_av, p_av, pc_av, pr_av, pt_av, q_av, ql_av, ql_c_av,  &
+               ql_v_av, ql_vp_av, qv_av, rho_av, s_av, sa_av, u_av, v_av,      &
+               vpt_av, w_av 
+    
+    USE cloud_parameters,                                                      &
+        ONLY:  l_d_cp, pt_d_t
+    
+    USE control_parameters,                                                    &
+        ONLY:  cloud_physics, domask, domask_no, domask_time_count, mask_i,    &
+               mask_j, mask_k, mask_size, mask_size_l, mask_start_l,           &
+               max_masks, message_string, mid, netcdf_data_format,             &
+               netcdf_output, nz_do3d, simulated_time
+    
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+    
+    USE indices,                                                               &
+        ONLY:  nbgp, nxl, nxr, nyn, nys, nzb, nzt
+        
+    USE kinds
+    
     USE netcdf
+    
     USE netcdf_control
-    USE particle_attributes
+    
+    USE particle_attributes,                                                   &
+        ONLY:  particles, prt_count, prt_start_index
+    
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER ::  av, ngp, i, if, j, k, n, psi, sender, &
-                ind(6)
-    LOGICAL ::  found, resorted
-    REAL    ::  mean_r, s_r3, s_r4
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  local_pf
+    INTEGER(iwp) ::  av       !: 
+    INTEGER(iwp) ::  ngp      !: 
+    INTEGER(iwp) ::  i        !: 
+    INTEGER(iwp) ::  if       !: 
+    INTEGER(iwp) ::  j        !: 
+    INTEGER(iwp) ::  k        !: 
+    INTEGER(iwp) ::  n        !: 
+    INTEGER(iwp) ::  psi      !: 
+    INTEGER(iwp) ::  sender   !: 
+    INTEGER(iwp) ::  ind(6)   !: 
+    
+    LOGICAL ::  found         !: 
+    LOGICAL ::  resorted      !: 
+    
+    REAL(wp) ::  mean_r       !: 
+    REAL(wp) ::  s_r3         !: 
+    REAL(wp) ::  s_r4         !: 
+    
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf    !:
 #if defined( __parallel )
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  total_pf
-#endif
-    REAL, DIMENSION(:,:,:), POINTER ::  to_be_resorted
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  total_pf    !:
+#endif
+    REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !:
 
 !
Index: /palm/trunk/SOURCE/data_output_profiles.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_profiles.f90	(revision 1319)
+++ /palm/trunk/SOURCE/data_output_profiles.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -42,24 +47,4 @@
 ! 964 2012-07-26 09:14:24Z raasch
 ! code for profil-output removed
-!
-! 345 2009-07-01 14:37:56Z heinze
-! In case of restart runs without extension, initial profiles are not written 
-! to NetCDF-file anymore.
-! simulated_time in NetCDF output replaced by time_since_reference_point.
-! Output of NetCDF messages with aid of message handling routine.
-! Output of messages replaced by message handling routine.
-!
-! 197 2008-09-16 15:29:03Z raasch
-! Time coordinate t=0 stored on netcdf-file only if an output is required for
-! this time for at least one of the profiles
-!
-! February 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! 87 2007-05-22 15:46:47Z raasch
-! var_hom renamed pr_palm
-!
-! Revision 1.18  2006/08/16 14:27:04  raasch
-! PRINT* statements for testing removed
 !
 ! Revision 1.1  1997/09/12 06:28:48  raasch
@@ -72,16 +57,31 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE cpulog
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  average_count_pr, averaging_interval_pr, coupling_start_time,   &
+               dopr_n, dopr_time_count, netcdf_output, normalizing_region,     &
+               time_since_reference_point
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE indices,                                                               &
+        ONLY:  nzb, nzt
+
+    USE kinds
+
     USE netcdf_control
+
     USE pegrid
+
     USE profil_parameter
-    USE statistics
+
+    USE statistics,                                                            &
+        ONLY:  flow_statistics_called, hom, hom_sum, pr_palm, statistic_regions
 
     IMPLICIT NONE
 
 
-    INTEGER ::  i, sr
+    INTEGER(iwp) ::  i  !:
+    INTEGER(iwp) ::  sr !:
 
 !
Index: /palm/trunk/SOURCE/data_output_ptseries.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_ptseries.f90	(revision 1319)
+++ /palm/trunk/SOURCE/data_output_ptseries.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -36,19 +41,4 @@
 ! mean/minimum/maximum particle radius added as output quantity,
 ! particle attributes speed_x|y|z_sgs renamed rvar1|2|3
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 291 2009-04-16 12:07:26Z raasch
-! simulated_time in NetCDF output replaced by time_since_reference_point.
-! Output of NetCDF messages with aid of message handling routine.
-!
-! 60 2007-03-11 11:50:04Z raasch
-! Particles-package is now part of the default code.
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.2  2006/08/22 13:51:13  raasch
-! Seperate output for particle groups
 !
 ! Revision 1.1  2006/08/04 14:24:18  raasch
@@ -61,10 +51,23 @@
 !------------------------------------------------------------------------------!
 
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE indices
+    USE cloud_parameters,                                                      &
+        ONLY:  curvature_solution_effects
+
+    USE control_parameters,                                                    &
+        ONLY:  dopts_time_count, netcdf_output, time_since_reference_point
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE indices,                                                               &
+        ONLY:
+
+    USE kinds
+
     USE netcdf_control
-    USE particle_attributes
+
+    USE particle_attributes,                                                   &
+        ONLY:  number_of_particles, number_of_particle_groups, particles
+
     USE pegrid
 
@@ -72,7 +75,11 @@
 
 
-    INTEGER ::  i, inum, j, n
-
-    REAL, DIMENSION(:,:), ALLOCATABLE ::  pts_value, pts_value_l
+    INTEGER(iwp) ::  i    !:
+    INTEGER(iwp) ::  inum !:
+    INTEGER(iwp) ::  j    !:
+    INTEGER(iwp) ::  n    !:
+
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pts_value   !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pts_value_l !:
 
 
Index: /palm/trunk/SOURCE/data_output_spectra.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_spectra.f90	(revision 1319)
+++ /palm/trunk/SOURCE/data_output_spectra.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -34,19 +39,4 @@
 ! 964 2012-07-26 09:14:24Z raasch
 ! code for profil-output removed
-!
-! 291 2009-04-16 12:07:26Z raasch
-! simulated_time in NetCDF output replaced by time_since_reference_point.
-! Output of NetCDF messages with aid of message handling routine.
-! Output of messages replaced by message handling routine.
-!
-! 189 2008-08-13 17:09:26Z letzel
-! allow 100 spectra levels instead of 10 for consistency with
-! define_netcdf_header, +user-defined spectra
-!
-! February 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.7  2006/04/11 14:56:38  raasch
-! pl_spectra renamed data_output_sp
 !
 ! Revision 1.1  2001/01/05 15:14:20  raasch
@@ -61,17 +51,32 @@
 #if defined( __spectra )
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
+    USE control_parameters,                                                    &
+        ONLY:  average_count_sp, averaging_interval_sp, dosp_time_count
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE kinds
+
     USE netcdf_control
+
     USE pegrid
-    USE spectrum
-    USE statistics
+
+    USE spectrum,                                                              &
+        ONLY:  data_output_sp
+
+    USE statistics,                                                            &
+        ONLY:  spectrum_x, spectrum_y
 
 
     IMPLICIT NONE
 
-    INTEGER :: m, pr, cranz_x, cranz_y
-    LOGICAL :: frame_x, frame_y
+    INTEGER(iwp) ::  cranz_x !:
+    INTEGER(iwp) ::  cranz_y !:
+    INTEGER(iwp) ::  m       !:
+    INTEGER(iwp) ::  pr      !:
+    
+    LOGICAL      ::  frame_x !: 
+    LOGICAL      ::  frame_y !:
 
     CALL cpu_log( log_point(31), 'data_output_spectra', 'start' )
@@ -183,24 +188,39 @@
 #if defined( __netcdf )
 
-    USE constants
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE constants,                                                             &
+        ONLY:  pi
+
+    USE control_parameters,                                                    &
+        ONLY:  dosp_time_count
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nx, ny
+
+    USE kinds
+
     USE netcdf_control
-    USE spectrum
-    USE statistics
+
+    USE spectrum,                                                              &
+        ONLY:  n_sp_x, n_sp_y
+
+    USE statistics,                                                            &
+        ONLY:  spectrum_x, spectrum_y
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=1), INTENT(IN) ::  direction
-
-    INTEGER, INTENT(IN) ::  nsp
-
-    INTEGER ::  i, k
-
-    REAL ::  frequency
-
-    REAL, DIMENSION(nx/2) ::  netcdf_data_x
-    REAL, DIMENSION(ny/2) ::  netcdf_data_y
+    CHARACTER (LEN=1), INTENT(IN) ::  direction     !:
+
+    INTEGER(iwp), INTENT(IN)      ::  nsp           !:
+
+    INTEGER(iwp)                  ::  i             !:
+    INTEGER(iwp)                  ::  k             !:
+
+    REAL(wp)                      ::  frequency     !:
+
+    REAL(wp), DIMENSION(nx/2)     ::  netcdf_data_x !:
+    REAL(wp), DIMENSION(ny/2)     ::  netcdf_data_y !:
 
 
@@ -248,36 +268,72 @@
  SUBROUTINE data_output_spectra_x( m, cranz, pr, frame_written )
 
-    USE arrays_3d
-    USE constants
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE constants,                                                             &
+        ONLY:  pi
+
+    USE control_parameters,                                                    &
+        ONLY:  averaging_interval_sp
+
+    USE grid_variables,                                                        &
+        ONLY:  dx
+
+    USE indices,                                                               &
+        ONLY:  nx
+
+    USE kinds
+
     USE pegrid
-    USE singleton
-    USE spectrum
-    USE statistics
-    USE transpose_indices
+
+    USE spectrum,                                                              &
+        ONLY:  comp_spectra_level, n_sp_x, plot_spectra_level
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=30) ::  atext
-    INTEGER            ::  i, j, k, m, pr
-    LOGICAL            ::  frame_written
-    REAL               ::  frequency = 0.0
-
+    CHARACTER (LEN=30) ::  atext !:
+    
+    INTEGER(iwp)       ::  i     !:
+    INTEGER(iwp)       ::  j     !:
+    INTEGER(iwp)       ::  k     !:
+    INTEGER(iwp)       ::  m     !:
+    INTEGER(iwp)       ::  pr    !:
+    
+    LOGICAL            ::  frame_written   !:
+    
+    REAL(wp)           ::  frequency = 0.0 !:
 !
 !-- Variables needed for PROFIL-namelist
-    INTEGER                  :: cranz, labforx = 3, labfory = 3, legpos = 3, &
-                                timodex = 1
-    INTEGER, DIMENSION(1:100):: cucol = 1, klist = 999999, lstyle = 0
-    LOGICAL                  :: datleg = .TRUE., grid = .TRUE., &
-                                lclose = .TRUE., rand = .TRUE., &
-                                swap = .TRUE., twoxa = .TRUE.,  &
-                                xlog = .TRUE., ylog = .TRUE.
-    CHARACTER (LEN=80)       :: rtext, utext, xtext = 'k in m>->1', ytext
-    REAL                     :: gwid = 0.1, rlegfak = 0.7, uxmin, uxmax, &
-                                uymin, uymax
-    REAL, DIMENSION(1:100)   :: lwid = 0.6
-    REAL, DIMENSION(100)     :: uyma, uymi
+    CHARACTER (LEN=80) ::  rtext                !:
+    CHARACTER (LEN=80) ::  utext                !:
+    CHARACTER (LEN=80) ::  xtext = 'k in m>->1' !:
+    CHARACTER (LEN=80) ::  ytext                !:
+
+    INTEGER(iwp)       ::  cranz       !:
+    INTEGER(iwp)       ::  labforx = 3 !:
+    INTEGER(iwp)       ::  labfory = 3 !:
+    INTEGER(iwp)       ::  legpos  = 3 !:
+    INTEGER(iwp)       ::  timodex = 1 !:
+    
+    INTEGER(iwp), DIMENSION(1:100) ::  cucol  = 1      !:
+    INTEGER(iwp), DIMENSION(1:100) ::  klist  = 999999 !:
+    INTEGER(iwp), DIMENSION(1:100) ::  lstyle = 0      !:
+    
+    LOGICAL ::  datleg = .TRUE. !:
+    LOGICAL ::  grid = .TRUE.   !:
+    LOGICAL ::  lclose = .TRUE. !:
+    LOGICAL ::  rand = .TRUE.   !:
+    LOGICAL ::  swap = .TRUE.   !:
+    LOGICAL ::  twoxa = .TRUE.  !:
+    LOGICAL ::  xlog = .TRUE.   !:
+    LOGICAL ::  ylog = .TRUE.   !:
+    
+    REAL(wp) ::  gwid = 0.1    !:
+    REAL(wp) ::  rlegfak = 0.7 !:
+    REAL(wp) ::  uxmin         !:
+    REAL(wp) ::  uxmax         !:
+    REAL(wp) ::  uymin         !:
+    REAL(wp) ::  uymax         !:
+     
+    REAL(wp), DIMENSION(1:100) ::  lwid = 0.6 !:
+    REAL(wp), DIMENSION(100)   ::  uyma       !:
+    REAL(wp), DIMENSION(100)   ::  uymi       !:
 
     NAMELIST /RAHMEN/  cranz, datleg, rtext, swap
@@ -407,36 +463,74 @@
  SUBROUTINE data_output_spectra_y( m, cranz, pr, frame_written )
 
-    USE arrays_3d
-    USE constants
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE constants,                                                             &
+        ONLY:  pi
+
+    USE control_parameters,                                                    &
+        ONLY:  averaging_interval_sp
+
+    USE grid_variables,                                                        &
+        ONLY:  dy
+
+    USE indices,                                                               &
+        ONLY:  ny
+
+    USE kinds
+
     USE pegrid
-    USE singleton
-    USE spectrum
-    USE statistics
-    USE transpose_indices
+
+    USE spectrum  comp_spectra_level, plot_spectra_level
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=30) ::  atext
-    INTEGER            :: i, j, k, m, pr
-    LOGICAL            :: frame_written
-    REAL               :: frequency = 0.0
+    
+    CHARACTER (LEN=30) ::  atext !:
+    
+    INTEGER(iwp)       ::  i     !:
+    INTEGER(iwp)       ::  j     !:
+    INTEGER(iwp)       ::  k     !:
+    INTEGER(iwp)       ::  m     !:
+    INTEGER(iwp)       ::  pr    !:
+    
+    LOGICAL            :: frame_written   !:
+    
+    REAL(wp)           :: frequency = 0.0 !:
 
 !
 !-- Variables needed for PROFIL-namelist
-    INTEGER                  :: cranz, labforx = 3, labfory = 3, legpos = 3, &
-                                timodex = 1
-    INTEGER, DIMENSION(1:100):: cucol = 1, klist = 999999, lstyle = 0
-    LOGICAL                  :: datleg = .TRUE., grid = .TRUE., &
-                                lclose = .TRUE., rand = .TRUE., &
-                                swap = .TRUE., twoxa = .TRUE.,  &
-                                xlog = .TRUE., ylog = .TRUE.
-    CHARACTER (LEN=80)       :: rtext, utext, xtext = 'k in m>->1', ytext
-    REAL                     :: gwid = 0.1, rlegfak = 0.7, uxmin, uxmax, &
-                                uymin, uymax
-    REAL, DIMENSION(1:100)   :: lwid = 0.6
-    REAL, DIMENSION(100)     :: uyma, uymi
+    CHARACTER (LEN=80) ::  rtext                !:
+    CHARACTER (LEN=80) ::  utext                !:
+    CHARACTER (LEN=80) ::  xtext = 'k in m>->1' !:
+    CHARACTER (LEN=80) ::  ytext                !:
+
+    INTEGER(iwp) ::  cranz       !:
+    INTEGER(iwp) ::  labforx = 3 !:
+    INTEGER(iwp) ::  labfory = 3 !:
+    INTEGER(iwp) ::  legpos  = 3 !:
+    INTEGER(iwp) ::  timodex = 1 !:
+    
+    INTEGER(iwp), DIMENSION(1:100) ::  cucol  = 1      !:
+    INTEGER(iwp), DIMENSION(1:100) ::  klist  = 999999 !:
+    INTEGER(iwp), DIMENSION(1:100) ::  lstyle = 0      !:
+    
+    LOGICAL ::  datleg = .TRUE. !:
+    LOGICAL ::  grid = .TRUE.   !:
+    LOGICAL ::  lclose = .TRUE. !:
+    LOGICAL ::  rand = .TRUE.   !:
+    LOGICAL ::  swap = .TRUE.   !:
+    LOGICAL ::  twoxa = .TRUE.  !:
+    LOGICAL ::  xlog = .TRUE.   !:
+    LOGICAL ::  ylog = .TRUE.   !:
+    
+    REAL(wp) ::  gwid = 0.1     !:
+    REAL(wp) ::  rlegfak = 0.7  !:
+    REAL(wp) ::  uxmin          !:
+    REAL(wp) ::  uxmax          !:
+    REAL(wp) ::  uymin          !:
+    REAL(wp) ::  uymax          !:
+    
+    REAL(wp), DIMENSION(1:100) ::  lwid = 0.6 !:
+    
+    REAL(wp), DIMENSION(100)   ::  uyma       !:
+    REAL(wp), DIMENSION(100)   ::  uymi       !:
 
     NAMELIST /RAHMEN/  cranz, datleg, rtext, swap
Index: /palm/trunk/SOURCE/data_output_tseries.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_tseries.f90	(revision 1319)
+++ /palm/trunk/SOURCE/data_output_tseries.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -36,17 +41,4 @@
 ! code put under GPL (PALM 3.9)
 !
-! 291 2009-04-16 12:07:26Z raasch
-! simulated_time in NetCDF output replaced by time_since_reference_point.
-! Output of NetCDF messages with aid of message handling routine.
-!
-! 48 2007-03-06 12:28:36Z raasch
-! Collection of time series quantities moved to routine flow_statistics,
-! output for "profil" removed
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.13  2006/03/14 12:42:51  raasch
-! Error removed: NetCDF output only if switched on
-!
 ! Revision 1.1  1998/03/03 08:00:13  raasch
 ! Initial revision
@@ -59,16 +51,26 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE cpulog
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  dots_time_count, netcdf_output, time_since_reference_point
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point  
+
+    USE kinds
+
     USE netcdf_control
+
     USE pegrid
+
     USE profil_parameter
-    USE statistics
+    
+    USE statistics,                                                            &
+        ONLY:  flow_statistics_called, statistic_regions, ts_value
 
     IMPLICIT NONE
 
 
-    INTEGER ::  i, sr
+    INTEGER(iwp) ::  i  !:
+    INTEGER(iwp) ::  sr !:
 
 
Index: /palm/trunk/SOURCE/diffusion_e.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_e.f90	(revision 1319)
+++ /palm/trunk/SOURCE/diffusion_e.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -60,31 +66,4 @@
 ! 825 2012-02-19 03:03:44Z raasch
 ! wang_collision_kernel renamed wang_kernel
-!
-! 790 2011-11-29 03:11:20Z raasch
-! diss is also calculated in case that the Wang kernel is used
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 97 2007-06-21 08:23:15Z raasch
-! Adjustment of mixing length calculation for the ocean version. zw added to
-! argument list.
-! This is also a bugfix, because the height above the topography is now
-! used instead of the height above level k=0.
-! theta renamed var, dpt_dz renamed dvar_dz, +new argument var_reference
-! use_pt_reference renamed use_reference
-!
-! 65 2007-03-13 12:11:43Z raasch
-! Reference temperature pt_reference can be used in buoyancy term
-!
-! 20 2007-02-26 00:12:32Z raasch
-! Bugfix: ddzw dimensioned 1:nzt"+1"
-! Calculation extended for gridpoint nzt
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.18  2006/08/04 14:29:43  raasch
-! dissipation is stored in extra array diss if needed later on for calculating
-! the sgs particle velocities
 !
 ! Revision 1.1  1997/09/19 07:40:24  raasch
@@ -118,21 +97,39 @@
     SUBROUTINE diffusion_e( var, var_reference )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE particle_attributes
+       USE arrays_3d,                                                          &
+           ONLY:  dd2zu, ddzu, ddzw, diss, e, km, l_grid, tend, zu, zw
+           
+       USE control_parameters,                                                 &
+           ONLY:  atmos_ocean_sign, g, turbulence, use_single_reference_value, &
+                  wall_adjustment, wall_adjustment_factor
+                  
+       USE grid_variables,                                                     &
+           ONLY:  ddx2, ddy2
+           
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb, nzb_s_inner, nzt
+           
+       USE kinds
+       
+       USE particle_attributes,                                                &
+           ONLY:  use_sgs_for_particles, wang_kernel
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  dvar_dz, l_stable, var_reference
+       INTEGER(iwp) ::  i              !: 
+       INTEGER(iwp) ::  j              !: 
+       INTEGER(iwp) ::  k              !: 
+       REAL(wp)     ::  dvar_dz        !: 
+       REAL(wp)     ::  l_stable       !: 
+       REAL(wp)     ::  var_reference  !: 
 
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var  !: 
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  var
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  var  !: 
 #endif
-       REAL, DIMENSION(nzb+1:nzt,nys:nyn) ::  dissipation, l, ll
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  dissipation  !:
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  l            !:
+       REAL(wp), DIMENSION(nzb+1:nzt,nys:nyn) ::  ll           !: 
  
 
@@ -304,19 +301,38 @@
     SUBROUTINE diffusion_e_acc( var, var_reference )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE particle_attributes
+       USE arrays_3d,                                                          &
+           ONLY:  dd2zu, ddzu, ddzw, diss, e, km, l_grid, tend, zu, zw
+          
+       USE control_parameters,                                                 &
+           ONLY:  atmos_ocean_sign, g, turbulence, use_single_reference_value, &
+                  wall_adjustment, wall_adjustment_factor
+                
+       USE grid_variables,                                                     &
+           ONLY:  ddx2, ddy2
+           
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nzb_s_inner, nzt
+           
+       USE kinds
+       
+       USE particle_attributes,                                                &
+           ONLY:  use_sgs_for_particles, wang_kernel
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  dissipation, dvar_dz, l, ll, l_stable, var_reference
+       INTEGER(iwp) ::  i              !: 
+       INTEGER(iwp) ::  j              !: 
+       INTEGER(iwp) ::  k              !: 
+       REAL(wp)     ::  dissipation    !: 
+       REAL(wp)     ::  dvar_dz        !: 
+       REAL(wp)     ::  l              !: 
+       REAL(wp)     ::  ll             !: 
+       REAL(wp)     ::  l_stable       !: 
+       REAL(wp)     ::  var_reference  !: 
 
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var  !: 
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  var
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  var  !: 
 #endif
 
@@ -481,21 +497,39 @@
     SUBROUTINE diffusion_e_ij( i, j, var, var_reference )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE particle_attributes
+       USE arrays_3d,                                                          &
+           ONLY:  dd2zu, ddzu, ddzw, diss, e, km, l_grid, tend, zu, zw
+          
+       USE control_parameters,                                                 &
+           ONLY:  atmos_ocean_sign, g, turbulence, use_single_reference_value, &
+                  wall_adjustment, wall_adjustment_factor
+                
+       USE grid_variables,                                                     &
+           ONLY:  ddx2, ddy2
+           
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_s_inner, nzt
+           
+       USE kinds
+       
+       USE particle_attributes,                                                &
+           ONLY:  use_sgs_for_particles, wang_kernel
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  dvar_dz, l_stable, var_reference
+       INTEGER(iwp) ::  i              !: 
+       INTEGER(iwp) ::  j              !: 
+       INTEGER(iwp) ::  k              !: 
+       REAL(wp)     ::  dvar_dz        !: 
+       REAL(wp)     ::  l_stable       !:
+       REAL(wp)     ::  var_reference  !:
 
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var  !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  var
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  var     !:
 #endif
-       REAL, DIMENSION(nzb+1:nzt) ::  dissipation, l, ll
+       REAL(wp), DIMENSION(nzb+1:nzt) ::  dissipation  !:
+       REAL(wp), DIMENSION(nzb+1:nzt) ::  l            !:
+       REAL(wp), DIMENSION(nzb+1:nzt) ::  ll           !:
 
 
Index: /palm/trunk/SOURCE/diffusion_s.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_s.f90	(revision 1319)
+++ /palm/trunk/SOURCE/diffusion_s.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -47,26 +53,4 @@
 ! 1001 2012-09-13 14:08:46Z raasch
 ! some arrays comunicated by module instead of parameter list
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 183 2008-08-04 15:39:12Z letzel
-! bugfix: calculation of fluxes at vertical surfaces
-!
-! 129 2007-10-30 12:12:24Z letzel
-! replace wall_heatflux by wall_s_flux that is now included in the parameter 
-! list, bugfix for assignment of fluxes at walls
-!
-! 20 2007-02-26 00:12:32Z raasch
-! Bugfix: ddzw dimensioned 1:nzt"+1"
-! Calculation extended for gridpoint nzt, fluxes can be given at top,
-! +s_flux_t in parameter list, s_flux renamed s_flux_b
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.8  2006/02/23 10:34:17  raasch
-! nzb_2d replaced by nzb_s_outer in horizontal diffusion and by nzb_s_inner
-! or nzb_diff_s_inner, respectively, in vertical diffusion, prescribed surface
-! fluxes at vertically oriented topography
 !
 ! Revision 1.1  2000/04/13 14:54:02  schroeter
@@ -99,18 +83,30 @@
     SUBROUTINE diffusion_s( s, s_flux_b, s_flux_t, wall_s_flux )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, ddzw, kh, tend
+       
+       USE control_parameters,                                                 & 
+           ONLY: use_surface_fluxes, use_top_fluxes
+       
+       USE grid_variables,                                                     &
+           ONLY:  ddx2, ddy2, fwxm, fwxp, fwym, fwyp, wall_w_x, wall_w_y
+       
+       USE indices,                                                            &
+           ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg,                  &
+                  nzb_diff_s_inner, nzb_s_inner, nzb_s_outer, nzt, nzt_diff
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  wall_s_flux(0:4)
-       REAL, DIMENSION(nysg:nyng,nxlg:nxrg) ::  s_flux_b, s_flux_t
+       INTEGER(iwp) ::  i                 !: 
+       INTEGER(iwp) ::  j                 !: 
+       INTEGER(iwp) ::  k                 !: 
+       REAL(wp)     ::  wall_s_flux(0:4)  !: 
+       REAL(wp), DIMENSION(nysg:nyng,nxlg:nxrg) ::  s_flux_b, s_flux_t !:
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  s
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  s  !: 
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  s
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  s  !: 
 #endif
 
@@ -121,12 +117,12 @@
              DO  k = nzb_s_outer(j,i)+1, nzt
 
-                tend(k,j,i) = tend(k,j,i)                                     &
-                                          + 0.5 * (                           &
-                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) ) &
-                      - ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) ) &
-                                                  ) * ddx2                    &
-                                          + 0.5 * (                           &
-                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) ) &
-                      - ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) ) &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                                          + 0.5 * (                            &
+                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) )  &
+                      - ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) )  &
+                                                  ) * ddx2                     &
+                                          + 0.5 * (                            &
+                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) )  &
+                      - ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) )  &
                                                   ) * ddy2
              ENDDO
@@ -138,18 +134,18 @@
                 DO  k = nzb_s_inner(j,i)+1, nzb_s_outer(j,i)
 
-                   tend(k,j,i) = tend(k,j,i)                                  &
-                                                + ( fwxp(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) ) &
-                        + ( 1.0 - fwxp(j,i) ) * wall_s_flux(1)                &
-                                                   -fwxm(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) ) &
-                        + ( 1.0 - fwxm(j,i) ) * wall_s_flux(2)                &
-                                                  ) * ddx2                    &
-                                                + ( fwyp(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) ) &
-                        + ( 1.0 - fwyp(j,i) ) * wall_s_flux(3)                &
-                                                   -fwym(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) ) &
-                        + ( 1.0 - fwym(j,i) ) * wall_s_flux(4)                &
+                   tend(k,j,i) = tend(k,j,i)                                   &
+                                                + ( fwxp(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) )  &
+                        + ( 1.0 - fwxp(j,i) ) * wall_s_flux(1)                 &
+                                                   -fwxm(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) )  &
+                        + ( 1.0 - fwxm(j,i) ) * wall_s_flux(2)                 &
+                                                  ) * ddx2                     &
+                                                + ( fwyp(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) )  &
+                        + ( 1.0 - fwyp(j,i) ) * wall_s_flux(3)                 &
+                                                   -fwym(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) )  &
+                        + ( 1.0 - fwym(j,i) ) * wall_s_flux(4)                 &
                                                   ) * ddy2
                 ENDDO
@@ -162,8 +158,8 @@
              DO  k = nzb_diff_s_inner(j,i), nzt_diff
 
-                tend(k,j,i) = tend(k,j,i)                                     &
-                                       + 0.5 * (                              &
-            ( kh(k,j,i) + kh(k+1,j,i) ) * ( s(k+1,j,i)-s(k,j,i) ) * ddzu(k+1) &
-          - ( kh(k,j,i) + kh(k-1,j,i) ) * ( s(k,j,i)-s(k-1,j,i) ) * ddzu(k)   &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                                       + 0.5 * (                               &
+            ( kh(k,j,i) + kh(k+1,j,i) ) * ( s(k+1,j,i)-s(k,j,i) ) * ddzu(k+1)  &
+          - ( kh(k,j,i) + kh(k-1,j,i) ) * ( s(k,j,i)-s(k-1,j,i) ) * ddzu(k)    &
                                                ) * ddzw(k)
              ENDDO
@@ -176,9 +172,9 @@
                 k = nzb_s_inner(j,i)+1
 
-                tend(k,j,i) = tend(k,j,i)                                     &
-                                       + ( 0.5 * ( kh(k,j,i)+kh(k+1,j,i) )    &
-                                               * ( s(k+1,j,i)-s(k,j,i) )      &
-                                               * ddzu(k+1)                    &
-                                           + s_flux_b(j,i)                    &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                                       + ( 0.5 * ( kh(k,j,i)+kh(k+1,j,i) )     &
+                                               * ( s(k+1,j,i)-s(k,j,i) )       &
+                                               * ddzu(k+1)                     &
+                                           + s_flux_b(j,i)                     &
                                          ) * ddzw(k)
 
@@ -192,9 +188,9 @@
                 k = nzt
 
-                tend(k,j,i) = tend(k,j,i)                                     &
-                                       + ( - s_flux_t(j,i)                    &
-                                           - 0.5 * ( kh(k-1,j,i)+kh(k,j,i) )  &
-                                                 * ( s(k,j,i)-s(k-1,j,i) )    &
-                                                 * ddzu(k)                    &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                                       + ( - s_flux_t(j,i)                     &
+                                           - 0.5 * ( kh(k-1,j,i)+kh(k,j,i) )   &
+                                                 * ( s(k,j,i)-s(k-1,j,i) )     &
+                                                 * ddzu(k)                     &
                                          ) * ddzw(k)
 
@@ -212,18 +208,31 @@
     SUBROUTINE diffusion_s_acc( s, s_flux_b, s_flux_t, wall_s_flux )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, ddzw, kh, tend
+           
+       USE control_parameters,                                                 & 
+           ONLY: use_surface_fluxes, use_top_fluxes
+       
+       USE grid_variables,                                                     &
+           ONLY:  ddx2, ddy2, fwxm, fwxp, fwym, fwyp, wall_w_x, wall_w_y
+       
+       USE indices, &
+           ONLY: i_left, i_right, j_north, j_south, nxlg, nxrg, nyng, nysg,    &
+                 nzb_diff_s_inner, nzb_s_inner, nzb_s_outer, nzt, nzt_diff
+           
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  wall_s_flux(0:4)
-       REAL, DIMENSION(nysg:nyng,nxlg:nxrg) ::  s_flux_b, s_flux_t
+       INTEGER(iwp) ::  i                 !: 
+       INTEGER(iwp) ::  j                 !: 
+       INTEGER(iwp) ::  k                 !: 
+       REAL(wp)     ::  wall_s_flux(0:4)  !: 
+       REAL(wp), DIMENSION(nysg:nyng,nxlg:nxrg) ::  s_flux_b !: 
+       REAL(wp), DIMENSION(nysg:nyng,nxlg:nxrg) ::  s_flux_t !: 
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  s
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  s  !:
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  s
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  s  !:
 #endif
 
@@ -239,12 +248,12 @@
                 IF ( k > nzb_s_outer(j,i) )  THEN
 
-                   tend(k,j,i) = tend(k,j,i)                                  &
-                                          + 0.5 * (                           &
-                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) ) &
-                      - ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) ) &
-                                                  ) * ddx2                    &
-                                          + 0.5 * (                           &
-                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) ) &
-                      - ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) ) &
+                   tend(k,j,i) = tend(k,j,i)                                   &
+                                          + 0.5 * (                            &
+                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) )  &
+                      - ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) )  &
+                                                  ) * ddx2                     &
+                                          + 0.5 * (                            &
+                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) )  &
+                      - ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) )  &
                                                   ) * ddy2
                 ENDIF
@@ -257,18 +266,18 @@
                      ( wall_w_x(j,i) /= 0.0  .OR.  wall_w_y(j,i) /= 0.0 ) )    &
                 THEN
-                   tend(k,j,i) = tend(k,j,i)                                  &
-                                                + ( fwxp(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) ) &
-                        + ( 1.0 - fwxp(j,i) ) * wall_s_flux(1)                &
-                                                   -fwxm(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) ) &
-                        + ( 1.0 - fwxm(j,i) ) * wall_s_flux(2)                &
-                                                  ) * ddx2                    &
-                                                + ( fwyp(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) ) &
-                        + ( 1.0 - fwyp(j,i) ) * wall_s_flux(3)                &
-                                                   -fwym(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) ) &
-                        + ( 1.0 - fwym(j,i) ) * wall_s_flux(4)                &
+                   tend(k,j,i) = tend(k,j,i)                                   &
+                                                + ( fwxp(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) )  &
+                        + ( 1.0 - fwxp(j,i) ) * wall_s_flux(1)                 &
+                                                   -fwxm(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) )  &
+                        + ( 1.0 - fwxm(j,i) ) * wall_s_flux(2)                 &
+                                                  ) * ddx2                     &
+                                                + ( fwyp(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) )  &
+                        + ( 1.0 - fwyp(j,i) ) * wall_s_flux(3)                 &
+                                                   -fwym(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) )  &
+                        + ( 1.0 - fwym(j,i) ) * wall_s_flux(4)                 &
                                                   ) * ddy2
                 ENDIF
@@ -281,8 +290,8 @@
              DO  k = 1, nzt_diff
                 IF ( k >= nzb_diff_s_inner(j,i) )  THEN
-                   tend(k,j,i) = tend(k,j,i)                                  &
-                                       + 0.5 * (                              &
-            ( kh(k,j,i) + kh(k+1,j,i) ) * ( s(k+1,j,i)-s(k,j,i) ) * ddzu(k+1) &
-          - ( kh(k,j,i) + kh(k-1,j,i) ) * ( s(k,j,i)-s(k-1,j,i) ) * ddzu(k)   &
+                   tend(k,j,i) = tend(k,j,i)                                   &
+                                       + 0.5 * (                               &
+            ( kh(k,j,i) + kh(k+1,j,i) ) * ( s(k+1,j,i)-s(k,j,i) ) * ddzu(k+1)  &
+          - ( kh(k,j,i) + kh(k-1,j,i) ) * ( s(k,j,i)-s(k-1,j,i) ) * ddzu(k)    &
                                                ) * ddzw(k)
                 ENDIF
@@ -294,9 +303,9 @@
              DO  k = 1, nzt
                 IF ( use_surface_fluxes  .AND.  k == nzb_s_inner(j,i)+1 )  THEN
-                   tend(k,j,i) = tend(k,j,i)                                  &
-                                          + ( 0.5 * ( kh(k,j,i)+kh(k+1,j,i) ) &
-                                                  * ( s(k+1,j,i)-s(k,j,i) )   &
-                                                  * ddzu(k+1)                 &
-                                              + s_flux_b(j,i)                 &
+                   tend(k,j,i) = tend(k,j,i)                                   &
+                                          + ( 0.5 * ( kh(k,j,i)+kh(k+1,j,i) )  &
+                                                  * ( s(k+1,j,i)-s(k,j,i) )    &
+                                                  * ddzu(k+1)                  &
+                                              + s_flux_b(j,i)                  &
                                             ) * ddzw(k)
                 ENDIF
@@ -327,18 +336,31 @@
     SUBROUTINE diffusion_s_ij( i, j, s, s_flux_b, s_flux_t, wall_s_flux )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, ddzw, kh, tend
+           
+       USE control_parameters,                                                 & 
+           ONLY: use_surface_fluxes, use_top_fluxes
+       
+       USE grid_variables,                                                     &
+           ONLY:  ddx2, ddy2, fwxm, fwxp, fwym, fwyp, wall_w_x, wall_w_y
+       
+       USE indices,                                                            &
+           ONLY:  nxlg, nxrg, nyng, nysg, nzb_diff_s_inner, nzb_s_inner,       &
+                  nzb_s_outer, nzt, nzt_diff
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  wall_s_flux(0:4)
-       REAL, DIMENSION(nysg:nyng,nxlg:nxrg) ::  s_flux_b, s_flux_t
+       INTEGER(iwp) ::  i                 !: 
+       INTEGER(iwp) ::  j                 !: 
+       INTEGER(iwp) ::  k                 !: 
+       REAL(wp)     ::  wall_s_flux(0:4)  !: 
+       REAL(wp), DIMENSION(nysg:nyng,nxlg:nxrg) ::  s_flux_b  !: 
+       REAL(wp), DIMENSION(nysg:nyng,nxlg:nxrg) ::  s_flux_t  !: 
 #if defined( __nopointer )
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  s
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  s !: 
 #else
-       REAL, DIMENSION(:,:,:), POINTER ::  s
+       REAL(wp), DIMENSION(:,:,:), POINTER ::  s  !: 
 #endif
 
@@ -347,12 +369,12 @@
        DO  k = nzb_s_outer(j,i)+1, nzt
 
-          tend(k,j,i) = tend(k,j,i)                                           &
-                                          + 0.5 * (                           &
-                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) ) &
-                      - ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) ) &
-                                                  ) * ddx2                    &
-                                          + 0.5 * (                           &
-                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) ) &
-                      - ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) ) &
+          tend(k,j,i) = tend(k,j,i)                                            &
+                                          + 0.5 * (                            &
+                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) )  &
+                      - ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) )  &
+                                                  ) * ddx2                     &
+                                          + 0.5 * (                            &
+                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) )  &
+                      - ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) )  &
                                                   ) * ddy2
        ENDDO
@@ -360,22 +382,22 @@
 !
 !--    Apply prescribed horizontal wall heatflux where necessary
-       IF ( ( wall_w_x(j,i) .NE. 0.0 ) .OR. ( wall_w_y(j,i) .NE. 0.0 ) ) &
+       IF ( ( wall_w_x(j,i) .NE. 0.0 ) .OR. ( wall_w_y(j,i) .NE. 0.0 ) )       &
        THEN
           DO  k = nzb_s_inner(j,i)+1, nzb_s_outer(j,i)
 
-             tend(k,j,i) = tend(k,j,i)                                        &
-                                                + ( fwxp(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) ) &
-                        + ( 1.0 - fwxp(j,i) ) * wall_s_flux(1)                &
-                                                   -fwxm(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) ) &
-                        + ( 1.0 - fwxm(j,i) ) * wall_s_flux(2)                &
-                                                  ) * ddx2                    &
-                                                + ( fwyp(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) ) &
-                        + ( 1.0 - fwyp(j,i) ) * wall_s_flux(3)                &
-                                                   -fwym(j,i) * 0.5 *         &
-                        ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) ) &
-                        + ( 1.0 - fwym(j,i) ) * wall_s_flux(4)                &
+             tend(k,j,i) = tend(k,j,i)                                         &
+                                                + ( fwxp(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j,i+1) ) * ( s(k,j,i+1)-s(k,j,i) )  &
+                        + ( 1.0 - fwxp(j,i) ) * wall_s_flux(1)                 &
+                                                   -fwxm(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j,i-1) ) * ( s(k,j,i)-s(k,j,i-1) )  &
+                        + ( 1.0 - fwxm(j,i) ) * wall_s_flux(2)                 &
+                                                  ) * ddx2                     &
+                                                + ( fwyp(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j+1,i) ) * ( s(k,j+1,i)-s(k,j,i) )  &
+                        + ( 1.0 - fwyp(j,i) ) * wall_s_flux(3)                 &
+                                                   -fwym(j,i) * 0.5 *          &
+                        ( kh(k,j,i) + kh(k,j-1,i) ) * ( s(k,j,i)-s(k,j-1,i) )  &
+                        + ( 1.0 - fwym(j,i) ) * wall_s_flux(4)                 &
                                                   ) * ddy2
           ENDDO
@@ -388,8 +410,8 @@
        DO  k = nzb_diff_s_inner(j,i), nzt_diff
 
-          tend(k,j,i) = tend(k,j,i)                                           &
-                                       + 0.5 * (                              &
-            ( kh(k,j,i) + kh(k+1,j,i) ) * ( s(k+1,j,i)-s(k,j,i) ) * ddzu(k+1) &
-          - ( kh(k,j,i) + kh(k-1,j,i) ) * ( s(k,j,i)-s(k-1,j,i) ) * ddzu(k)   &
+          tend(k,j,i) = tend(k,j,i)                                            &
+                                       + 0.5 * (                               &
+            ( kh(k,j,i) + kh(k+1,j,i) ) * ( s(k+1,j,i)-s(k,j,i) ) * ddzu(k+1)  &
+          - ( kh(k,j,i) + kh(k-1,j,i) ) * ( s(k,j,i)-s(k-1,j,i) ) * ddzu(k)    &
                                                ) * ddzw(k)
        ENDDO
@@ -401,8 +423,8 @@
           k = nzb_s_inner(j,i)+1
 
-          tend(k,j,i) = tend(k,j,i) + ( 0.5 * ( kh(k,j,i)+kh(k+1,j,i) )  &
-                                            * ( s(k+1,j,i)-s(k,j,i) )    &
-                                            * ddzu(k+1)                  &
-                                        + s_flux_b(j,i)                  &
+          tend(k,j,i) = tend(k,j,i) + ( 0.5 * ( kh(k,j,i)+kh(k+1,j,i) )        &
+                                            * ( s(k+1,j,i)-s(k,j,i) )          &
+                                            * ddzu(k+1)                        &
+                                        + s_flux_b(j,i)                        &
                                       ) * ddzw(k)
 
@@ -415,8 +437,8 @@
           k = nzt
 
-          tend(k,j,i) = tend(k,j,i) + ( - s_flux_t(j,i)                  &
-                                      - 0.5 * ( kh(k-1,j,i)+kh(k,j,i) )  &
-                                            * ( s(k,j,i)-s(k-1,j,i) )    &
-                                            * ddzu(k)                    &
+          tend(k,j,i) = tend(k,j,i) + ( - s_flux_t(j,i)                        &
+                                      - 0.5 * ( kh(k-1,j,i)+kh(k,j,i) )        &
+                                            * ( s(k,j,i)-s(k-1,j,i) )          &
+                                            * ddzu(k)                          &
                                       ) * ddzw(k)
 
Index: /palm/trunk/SOURCE/diffusion_u.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_u.f90	(revision 1319)
+++ /palm/trunk/SOURCE/diffusion_u.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -46,31 +52,4 @@
 ! outflow damping layer removed
 ! kmym_x/_y and kmyp_x/_y change to kmym and kmyp
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 366 2009-08-25 08:06:27Z raasch
-! bc_ns replaced by bc_ns_cyc
-!
-! 106 2007-08-16 14:30:26Z raasch
-! Momentumflux at top (uswst) included as boundary condition,
-! i loop is starting from nxlu (needed for non-cyclic boundary conditions)
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Wall functions now include diabatic conditions, call of routine wall_fluxes,
-! z0 removed from argument list, uxrp eliminated
-!
-! 20 2007-02-26 00:12:32Z raasch
-! Bugfix: ddzw dimensioned 1:nzt"+1"
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.15  2006/02/23 10:35:35  raasch
-! nzb_2d replaced by nzb_u_outer in horizontal diffusion and by nzb_u_inner
-! or nzb_diff_u, respectively, in vertical diffusion,
-! wall functions added for north and south walls, +z0 in argument list,
-! terms containing w(k-1,..) are removed from the Prandtl-layer equation
-! because they cause errors at the edges of topography
-! WARNING: loops containing the MAX function are still not properly vectorized!
 !
 ! Revision 1.1  1997/09/12 06:23:51  raasch
@@ -107,15 +86,31 @@
     SUBROUTINE diffusion_u
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, ddzw, km, tend, u, usws, uswst, v, w
+       
+       USE control_parameters,                                                 &
+           ONLY:  constant_top_momentumflux, topography, use_surface_fluxes,   &
+                  use_top_fluxes
+       
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddx2, ddy, fym, fyp, wall_u
+       
+       USE indices,                                                            &
+           ONLY:  nxl, nxlu, nxr, nyn, nys, nzb, nzb_diff_u, nzb_u_inner,      &
+                  nzb_u_outer, nzt, nzt_diff
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  kmym, kmyp, kmzm, kmzp
-
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  usvs
+       INTEGER(iwp) ::  i     !: 
+       INTEGER(iwp) ::  j     !: 
+       INTEGER(iwp) ::  k     !: 
+       REAL(wp)     ::  kmym  !:
+       REAL(wp)     ::  kmyp  !:
+       REAL(wp)     ::  kmzm  !:
+       REAL(wp)     ::  kmzp  !:
+
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  usvs  !: 
 
 !
@@ -123,5 +118,5 @@
 !--    if neccessary
        IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes( usvs, 1.0, 0.0, 0.0, 0.0, nzb_u_inner, &
+          CALL wall_fluxes( usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, nzb_u_inner, &
                             nzb_u_outer, wall_u )
        ENDIF
@@ -134,18 +129,18 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmyp = 0.25 * &
+                kmyp = 0.25 *                                                  &
                        ( km(k,j,i)+km(k,j+1,i)+km(k,j,i-1)+km(k,j+1,i-1) )
-                kmym = 0.25 * &
+                kmym = 0.25 *                                                  &
                        ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & + 2.0 * (                                            &
-                      &           km(k,j,i)   * ( u(k,j,i+1) - u(k,j,i)   )  &
-                      &         - km(k,j,i-1) * ( u(k,j,i)   - u(k,j,i-1) )  &
-                      &         ) * ddx2                                     &
-                      & + ( kmyp * ( u(k,j+1,i) - u(k,j,i)     ) * ddy       &
-                      &   + kmyp * ( v(k,j+1,i) - v(k,j+1,i-1) ) * ddx       &
-                      &   - kmym * ( u(k,j,i) - u(k,j-1,i) ) * ddy           &
-                      &   - kmym * ( v(k,j,i) - v(k,j,i-1) ) * ddx           &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & + 2.0 * (                                              &
+                      &           km(k,j,i)   * ( u(k,j,i+1) - u(k,j,i)   )    &
+                      &         - km(k,j,i-1) * ( u(k,j,i)   - u(k,j,i-1) )    &
+                      &         ) * ddx2                                       &
+                      & + ( kmyp * ( u(k,j+1,i) - u(k,j,i)     ) * ddy         &
+                      &   + kmyp * ( v(k,j+1,i) - v(k,j+1,i-1) ) * ddx         &
+                      &   - kmym * ( u(k,j,i) - u(k,j-1,i) ) * ddy             &
+                      &   - kmym * ( v(k,j,i) - v(k,j,i-1) ) * ddx             &
                       &   ) * ddy
              ENDDO
@@ -156,7 +151,7 @@
 
                 DO  k = nzb_u_inner(j,i)+1, nzb_u_outer(j,i)
-                   kmyp = 0.25 * &
+                   kmyp = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j+1,i)+km(k,j,i-1)+km(k,j+1,i-1) )
-                   kmym = 0.25 * &
+                   kmym = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) )
 
@@ -185,16 +180,16 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25 * &
+                kmzp = 0.25 *                                                  &
                        ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) )
-                kmzm = 0.25 * &
+                kmzm = 0.25 *                                                  &
                        ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & + ( kmzp * ( ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1) &
-                      &            + ( w(k,j,i)   - w(k,j,i-1) ) * ddx       &
-                      &            )                                         &
-                      &   - kmzm * ( ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k) &
-                      &            + ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx     &
-                      &            )                                          &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & + ( kmzp * ( ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1)   &
+                      &            + ( w(k,j,i)   - w(k,j,i-1) ) * ddx         &
+                      &            )                                           &
+                      &   - kmzm * ( ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k)   &
+                      &            + ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx       &
+                      &            )                                           &
                       &   ) * ddzw(k)
              ENDDO
@@ -206,5 +201,5 @@
 !--          Difference quotient of the momentum flux is not formed over half
 !--          of the grid spacing (2.0*ddzw(k)) any more, since the comparison
-!--          with other (LES) modell showed that the values of the momentum
+!--          with other (LES) models showed that the values of the momentum
 !--          flux becomes too large in this case.
 !--          The term containing w(k-1,..) (see above equation) is removed here
@@ -214,14 +209,14 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25 * &
+                kmzp = 0.25 *                                                  &
                       ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) )
-                kmzm = 0.25 * &
+                kmzm = 0.25 *                                                  &
                       ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & + ( kmzp * ( w(k,j,i)   - w(k,j,i-1)   ) * ddx       &
-                      &   ) * ddzw(k)                                        &
-                      & + ( kmzp * ( u(k+1,j,i) - u(k,j,i)     ) * ddzu(k+1) &
-                      &   + usws(j,i)                                        &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & + ( kmzp * ( w(k,j,i)   - w(k,j,i-1)   ) * ddx         &
+                      &   ) * ddzw(k)                                          &
+                      & + ( kmzp * ( u(k+1,j,i) - u(k,j,i)     ) * ddzu(k+1)   &
+                      &   + usws(j,i)                                          &
                       &   ) * ddzw(k)
              ENDIF
@@ -234,14 +229,14 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25 * &
+                kmzp = 0.25 *                                                  &
                        ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) )
-                kmzm = 0.25 * &
+                kmzm = 0.25 *                                                  &
                        ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & - ( kmzm * ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx       &
-                      &   ) * ddzw(k)                                        &
-                      & + ( -uswst(j,i)                                      &
-                      &   - kmzm * ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k)   &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & - ( kmzm * ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx         &
+                      &   ) * ddzw(k)                                          &
+                      & + ( -uswst(j,i)                                        &
+                      &   - kmzm * ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k)     &
                       &   ) * ddzw(k)
              ENDIF
@@ -258,15 +253,31 @@
     SUBROUTINE diffusion_u_acc
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, ddzw, km, tend, u, usws, uswst, v, w
+       
+       USE control_parameters,                                                 &
+           ONLY:  constant_top_momentumflux, topography, use_surface_fluxes,   &
+                  use_top_fluxes
+       
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddx2, ddy, fym, fyp, wall_u
+       
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb,  &
+                  nzb_diff_u, nzb_u_inner, nzb_u_outer, nzt, nzt_diff
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  kmym, kmyp, kmzm, kmzp
-
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  usvs
+       INTEGER(iwp) ::  i     !: 
+       INTEGER(iwp) ::  j     !: 
+       INTEGER(iwp) ::  k     !: 
+       REAL(wp)     ::  kmym  !:
+       REAL(wp)     ::  kmyp  !:
+       REAL(wp)     ::  kmzm  !:
+       REAL(wp)     ::  kmzp  !:
+
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  usvs  !: 
        !$acc declare create ( usvs )
 
@@ -275,10 +286,10 @@
 !--    if neccessary
        IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes_acc( usvs, 1.0, 0.0, 0.0, 0.0, nzb_u_inner, &
-                                nzb_u_outer, wall_u )
-       ENDIF
-
-       !$acc kernels present ( u, v, w, km, tend, usws, uswst )   &
-       !$acc         present ( ddzu, ddzw, fym, fyp, wall_u )           &
+          CALL wall_fluxes_acc( usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp,          &
+                                nzb_u_inner, nzb_u_outer, wall_u )
+       ENDIF
+
+       !$acc kernels present ( u, v, w, km, tend, usws, uswst )                &
+       !$acc         present ( ddzu, ddzw, fym, fyp, wall_u )                  &
        !$acc         present ( nzb_u_inner, nzb_u_outer, nzb_diff_u )
        DO  i = i_left, i_right
@@ -290,7 +301,7 @@
 !
 !--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmyp = 0.25 * &
+                   kmyp = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j+1,i)+km(k,j,i-1)+km(k,j+1,i-1) )
-                   kmym = 0.25 * &
+                   kmym = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) )
 
@@ -311,10 +322,10 @@
 !--          Wall functions at the north and south walls, respectively
              DO  k = 1, nzt
-                IF( k > nzb_u_inner(j,i)  .AND.  k <= nzb_u_outer(j,i)  .AND. &
+                IF( k > nzb_u_inner(j,i)  .AND.  k <= nzb_u_outer(j,i)  .AND.  &
                     wall_u(j,i) /= 0.0 )  THEN
 
-                   kmyp = 0.25 * &
+                   kmyp = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j+1,i)+km(k,j,i-1)+km(k,j+1,i-1) )
-                   kmym = 0.25 * &
+                   kmym = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) )
 
@@ -344,7 +355,7 @@
 !
 !--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmzp = 0.25 * &
+                   kmzp = 0.25 *                                               &
                           ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) )
-                   kmzm = 0.25 * &
+                   kmzm = 0.25 *                                               &
                           ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
 
@@ -369,5 +380,5 @@
 !--    Difference quotient of the momentum flux is not formed over half
 !--    of the grid spacing (2.0*ddzw(k)) any more, since the comparison
-!--    with other (LES) modell showed that the values of the momentum
+!--    with other (LES) models showed that the values of the momentum
 !--    flux becomes too large in this case.
 !--    The term containing w(k-1,..) (see above equation) is removed here
@@ -381,14 +392,14 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25 * &
+                kmzp = 0.25 *                                                  &
                       ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) )
-                kmzm = 0.25 * &
+                kmzm = 0.25 *                                                  &
                       ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & + ( kmzp * ( w(k,j,i)   - w(k,j,i-1)   ) * ddx       &
-                      &   ) * ddzw(k)                                        &
-                      & + ( kmzp * ( u(k+1,j,i) - u(k,j,i)     ) * ddzu(k+1) &
-                      &   + usws(j,i)                                        &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & + ( kmzp * ( w(k,j,i)   - w(k,j,i-1)   ) * ddx         &
+                      &   ) * ddzw(k)                                          &
+                      & + ( kmzp * ( u(k+1,j,i) - u(k,j,i)     ) * ddzu(k+1)   &
+                      &   + usws(j,i)                                          &
                       &   ) * ddzw(k)
              ENDDO
@@ -409,14 +420,14 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25 * &
+                kmzp = 0.25 *                                                  &
                        ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) )
-                kmzm = 0.25 * &
+                kmzm = 0.25 *                                                  &
                        ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & - ( kmzm * ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx       &
-                      &   ) * ddzw(k)                                        &
-                      & + ( -uswst(j,i)                                      &
-                      &   - kmzm * ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k)   &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & - ( kmzm * ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx         &
+                      &   ) * ddzw(k)                                          &
+                      & + ( -uswst(j,i)                                        &
+                      &   - kmzm * ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k)     &
                       &   ) * ddzw(k)
              ENDDO
@@ -434,15 +445,29 @@
     SUBROUTINE diffusion_u_ij( i, j )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, ddzw, km, tend, u, usws, uswst, v, w
+       
+       USE control_parameters,                                                 &
+           ONLY:  constant_top_momentumflux, use_surface_fluxes, use_top_fluxes
+       
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddx2, ddy, fym, fyp, wall_u
+       
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_diff_u, nzb_u_inner, nzb_u_outer, nzt, nzt_diff
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  kmym, kmyp, kmzm, kmzp
-
-       REAL, DIMENSION(nzb:nzt+1) ::  usvs
+       INTEGER(iwp) ::  i     !: 
+       INTEGER(iwp) ::  j     !: 
+       INTEGER(iwp) ::  k     !: 
+       REAL(wp)     ::  kmym  !:
+       REAL(wp)     ::  kmyp  !:
+       REAL(wp)     ::  kmzm  !:
+       REAL(wp)     ::  kmzp  !:
+
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  usvs  !: 
 
 !
@@ -454,13 +479,13 @@
           kmym = 0.25 * ( km(k,j,i)+km(k,j-1,i)+km(k,j,i-1)+km(k,j-1,i-1) )
 
-          tend(k,j,i) = tend(k,j,i)                                          &
-                      & + 2.0 * (                                            &
-                      &           km(k,j,i)   * ( u(k,j,i+1) - u(k,j,i)   )  &
-                      &         - km(k,j,i-1) * ( u(k,j,i)   - u(k,j,i-1) )  &
-                      &         ) * ddx2                                     &
-                      & + ( kmyp * ( u(k,j+1,i) - u(k,j,i)     ) * ddy       &
-                      &   + kmyp * ( v(k,j+1,i) - v(k,j+1,i-1) ) * ddx       &
-                      &   - kmym * ( u(k,j,i) - u(k,j-1,i) ) * ddy           &
-                      &   - kmym * ( v(k,j,i) - v(k,j,i-1) ) * ddx           &
+          tend(k,j,i) = tend(k,j,i)                                            &
+                      & + 2.0 * (                                              &
+                      &           km(k,j,i)   * ( u(k,j,i+1) - u(k,j,i)   )    &
+                      &         - km(k,j,i-1) * ( u(k,j,i)   - u(k,j,i-1) )    &
+                      &         ) * ddx2                                       &
+                      & + ( kmyp * ( u(k,j+1,i) - u(k,j,i)     ) * ddy         &
+                      &   + kmyp * ( v(k,j+1,i) - v(k,j+1,i-1) ) * ddx         &
+                      &   - kmym * ( u(k,j,i) - u(k,j-1,i) ) * ddy             &
+                      &   - kmym * ( v(k,j,i) - v(k,j,i-1) ) * ddx             &
                       &   ) * ddy
        ENDDO
@@ -472,6 +497,6 @@
 !
 !--       Calculate the horizontal momentum flux u'v'
-          CALL wall_fluxes( i, j, nzb_u_inner(j,i)+1, nzb_u_outer(j,i),  &
-                            usvs, 1.0, 0.0, 0.0, 0.0 )
+          CALL wall_fluxes( i, j, nzb_u_inner(j,i)+1, nzb_u_outer(j,i),        &
+                            usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp )
 
           DO  k = nzb_u_inner(j,i)+1, nzb_u_outer(j,i)
@@ -506,11 +531,11 @@
           kmzm = 0.25 * ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
 
-          tend(k,j,i) = tend(k,j,i)                                          &
-                      & + ( kmzp * ( ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1) &
-                      &            + ( w(k,j,i)   - w(k,j,i-1) ) * ddx       &
-                      &            )                                         &
-                      &   - kmzm * ( ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k) &
-                      &            + ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx     &
-                      &            )                                         &
+          tend(k,j,i) = tend(k,j,i)                                            &
+                      & + ( kmzp * ( ( u(k+1,j,i) - u(k,j,i)   ) * ddzu(k+1)   &
+                      &            + ( w(k,j,i)   - w(k,j,i-1) ) * ddx         &
+                      &            )                                           &
+                      &   - kmzm * ( ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k)   &
+                      &            + ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx       &
+                      &            )                                           &
                       &   ) * ddzw(k)
        ENDDO
@@ -522,5 +547,5 @@
 !--    Difference quotient of the momentum flux is not formed over half of
 !--    the grid spacing (2.0*ddzw(k)) any more, since the comparison with 
-!--    other (LES) modell showed that the values of the momentum flux becomes
+!--    other (LES) models showed that the values of the momentum flux becomes
 !--    too large in this case.
 !--    The term containing w(k-1,..) (see above equation) is removed here
@@ -533,9 +558,9 @@
           kmzm = 0.25 * ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
 
-          tend(k,j,i) = tend(k,j,i)                                          &
-                      & + ( kmzp * ( w(k,j,i)   - w(k,j,i-1)   ) * ddx       &
-                      &   ) * ddzw(k)                                        &
-                      & + ( kmzp * ( u(k+1,j,i) - u(k,j,i)     ) * ddzu(k+1) &
-                      &   + usws(j,i)                                        &
+          tend(k,j,i) = tend(k,j,i)                                            &
+                      & + ( kmzp * ( w(k,j,i)   - w(k,j,i-1)   ) * ddx         &
+                      &   ) * ddzw(k)                                          &
+                      & + ( kmzp * ( u(k+1,j,i) - u(k,j,i)     ) * ddzu(k+1)   &
+                      &   + usws(j,i)                                          &
                       &   ) * ddzw(k)
        ENDIF
@@ -548,14 +573,14 @@
 !
 !--       Interpolate eddy diffusivities on staggered gridpoints
-          kmzp = 0.25 * &
+          kmzp = 0.25 *                                                        &
                  ( km(k,j,i)+km(k+1,j,i)+km(k,j,i-1)+km(k+1,j,i-1) )
-          kmzm = 0.25 * &
+          kmzm = 0.25 *                                                        &
                  ( km(k,j,i)+km(k-1,j,i)+km(k,j,i-1)+km(k-1,j,i-1) )
 
-          tend(k,j,i) = tend(k,j,i)                                          &
-                      & - ( kmzm * ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx       &
-                      &   ) * ddzw(k)                                        &
-                      & + ( -uswst(j,i)                                      &
-                      &   - kmzm * ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k)   &
+          tend(k,j,i) = tend(k,j,i)                                            &
+                      & - ( kmzm * ( w(k-1,j,i) - w(k-1,j,i-1) ) * ddx         &
+                      &   ) * ddzw(k)                                          &
+                      & + ( -uswst(j,i)                                        &
+                      &   - kmzm * ( u(k,j,i)   - u(k-1,j,i)   ) * ddzu(k)     &
                       &   ) * ddzw(k)
        ENDIF
Index: /palm/trunk/SOURCE/diffusion_v.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_v.f90	(revision 1319)
+++ /palm/trunk/SOURCE/diffusion_v.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -46,31 +52,4 @@
 ! outflow damping layer removed
 ! kmxm_x/_y and kmxp_x/_y change to kmxm and kmxp
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 366 2009-08-25 08:06:27Z raasch
-! bc_lr replaced by bc_lr_cyc
-!
-! 106 2007-08-16 14:30:26Z raasch
-! Momentumflux at top (vswst) included as boundary condition,
-! j loop is starting from nysv (needed for non-cyclic boundary conditions)
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Wall functions now include diabatic conditions, call of routine wall_fluxes,
-! z0 removed from argument list, vynp eliminated
-!
-! 20 2007-02-26 00:12:32Z raasch
-! Bugfix: ddzw dimensioned 1:nzt"+1"
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.15  2006/02/23 10:36:00  raasch
-! nzb_2d replaced by nzb_v_outer in horizontal diffusion and by nzb_v_inner
-! or nzb_diff_v, respectively, in vertical diffusion,
-! wall functions added for north and south walls, +z0 in argument list,
-! terms containing w(k-1,..) are removed from the Prandtl-layer equation
-! because they cause errors at the edges of topography
-! WARNING: loops containing the MAX function are still not properly vectorized!
 !
 ! Revision 1.1  1997/09/12 06:24:01  raasch
@@ -105,15 +84,31 @@
     SUBROUTINE diffusion_v
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, ddzw, km, tend, u, v, vsws, vswst, w
+       
+       USE control_parameters,                                                 &
+           ONLY:  constant_top_momentumflux, topography, use_surface_fluxes,   &
+                  use_top_fluxes
+       
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy, ddy2, fxm, fxp, wall_v
+       
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nysv, nzb, nzb_diff_v, nzb_v_inner,      &
+                  nzb_v_outer, nzt, nzt_diff
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  kmxm, kmxp, kmzm, kmzp
-
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  vsus
+       INTEGER(iwp) ::  i     !: 
+       INTEGER(iwp) ::  j     !: 
+       INTEGER(iwp) ::  k     !: 
+       REAL(wp)     ::  kmxm  !: 
+       REAL(wp)     ::  kmxp  !: 
+       REAL(wp)     ::  kmzm  !: 
+       REAL(wp)     ::  kmzp  !: 
+
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  vsus  !: 
 
 !
@@ -121,5 +116,5 @@
 !--    if neccessary
        IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes( vsus, 0.0, 1.0, 0.0, 0.0, nzb_v_inner, &
+          CALL wall_fluxes( vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp, nzb_v_inner, &
                             nzb_v_outer, wall_v )
        ENDIF
@@ -137,13 +132,13 @@
                        ( km(k,j,i)+km(k,j,i-1)+km(k,j-1,i)+km(k,j-1,i-1) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & + ( kmxp * ( v(k,j,i+1) - v(k,j,i)     ) * ddx       &
-                      &   + kmxp * ( u(k,j,i+1) - u(k,j-1,i+1) ) * ddy       &
-                      &   - kmxm * ( v(k,j,i) - v(k,j,i-1) ) * ddx           &
-                      &   - kmxm * ( u(k,j,i) - u(k,j-1,i) ) * ddy           &
-                      &   ) * ddx                                            &
-                      & + 2.0 * (                                            &
-                      &           km(k,j,i)   * ( v(k,j+1,i) - v(k,j,i) )    &
-                      &         - km(k,j-1,i) * ( v(k,j,i) - v(k,j-1,i) )    &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & + ( kmxp * ( v(k,j,i+1) - v(k,j,i)     ) * ddx         &
+                      &   + kmxp * ( u(k,j,i+1) - u(k,j-1,i+1) ) * ddy         &
+                      &   - kmxm * ( v(k,j,i) - v(k,j,i-1) ) * ddx             &
+                      &   - kmxm * ( u(k,j,i) - u(k,j-1,i) ) * ddy             &
+                      &   ) * ddx                                              &
+                      & + 2.0 * (                                              &
+                      &           km(k,j,i)   * ( v(k,j+1,i) - v(k,j,i) )      &
+                      &         - km(k,j-1,i) * ( v(k,j,i) - v(k,j-1,i) )      &
                       &         ) * ddy2
              ENDDO
@@ -154,7 +149,7 @@
 
                 DO  k = nzb_v_inner(j,i)+1, nzb_v_outer(j,i)
-                   kmxp = 0.25 * &
+                   kmxp = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j,i+1)+km(k,j-1,i)+km(k,j-1,i+1) )
-                   kmxm = 0.25 * &
+                   kmxm = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j,i-1)+km(k,j-1,i)+km(k,j-1,i-1) )
                    
@@ -188,11 +183,11 @@
                        ( km(k,j,i)+km(k-1,j,i)+km(k,j-1,i)+km(k-1,j-1,i) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & + ( kmzp * ( ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)   &
-                      &            + ( w(k,j,i) - w(k,j-1,i) ) * ddy         &
-                      &            )                                         &
-                      &   - kmzm * ( ( v(k,j,i)   - v(k-1,j,i)   ) * ddzu(k) &
-                      &            + ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy     &
-                      &            )                                         &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & + ( kmzp * ( ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)     &
+                      &            + ( w(k,j,i) - w(k,j-1,i) ) * ddy           &
+                      &            )                                           &
+                      &   - kmzm * ( ( v(k,j,i)   - v(k-1,j,i)   ) * ddzu(k)   &
+                      &            + ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy       &
+                      &            )                                           &
                       &   ) * ddzw(k)
              ENDDO
@@ -204,5 +199,5 @@
 !--          Difference quotient of the momentum flux is not formed over
 !--          half of the grid spacing (2.0*ddzw(k)) any more, since the
-!--          comparison with other (LES) modell showed that the values of
+!--          comparison with other (LES) models showed that the values of
 !--          the momentum flux becomes too large in this case.
 !--          The term containing w(k-1,..) (see above equation) is removed here
@@ -212,14 +207,14 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25 * &
+                kmzp = 0.25 *                                                  &
                        ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
-                kmzm = 0.25 * &
+                kmzm = 0.25 *                                                  &
                        ( km(k,j,i)+km(k-1,j,i)+km(k,j-1,i)+km(k-1,j-1,i) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & + ( kmzp * ( w(k,j,i) - w(k,j-1,i)     ) * ddy       &
-                      &   ) * ddzw(k)                                        &
-                      & + ( kmzp * ( v(k+1,j,i) - v(k,j,i)     ) * ddzu(k+1) &
-                      &   + vsws(j,i)                                        &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & + ( kmzp * ( w(k,j,i) - w(k,j-1,i)     ) * ddy         &
+                      &   ) * ddzw(k)                                          &
+                      & + ( kmzp * ( v(k+1,j,i) - v(k,j,i)     ) * ddzu(k+1)   &
+                      &   + vsws(j,i)                                          &
                       &   ) * ddzw(k)
              ENDIF
@@ -232,14 +227,14 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25 * &
+                kmzp = 0.25 *                                                  &
                        ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
-                kmzm = 0.25 * &
+                kmzm = 0.25 *                                                  &
                        ( km(k,j,i)+km(k-1,j,i)+km(k,j-1,i)+km(k-1,j-1,i) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & - ( kmzm *  ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy      &
-                      &   ) * ddzw(k)                                        &
-                      & + ( -vswst(j,i)                                      &
-                      &   - kmzm * ( v(k,j,i)   - v(k-1,j,i)    ) * ddzu(k)  &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & - ( kmzm *  ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy        &
+                      &   ) * ddzw(k)                                          &
+                      & + ( -vswst(j,i)                                        &
+                      &   - kmzm * ( v(k,j,i)   - v(k-1,j,i)    ) * ddzu(k)    &
                       &   ) * ddzw(k)
              ENDIF
@@ -256,15 +251,31 @@
     SUBROUTINE diffusion_v_acc
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, ddzw, km, tend, u, v, vsws, vswst, w
+       
+       USE control_parameters,                                                 &
+           ONLY:  constant_top_momentumflux, topography, use_surface_fluxes,   &
+                  use_top_fluxes
+       
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy, ddy2, fxm, fxp, wall_v
+       
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb,  &
+                  nzb_diff_v, nzb_v_inner, nzb_v_outer, nzt, nzt_diff
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  kmxm, kmxp, kmzm, kmzp
-
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  vsus
+       INTEGER(iwp) ::  i     !: 
+       INTEGER(iwp) ::  j     !: 
+       INTEGER(iwp) ::  k     !: 
+       REAL(wp)     ::  kmxm  !: 
+       REAL(wp)     ::  kmxp  !: 
+       REAL(wp)     ::  kmzm  !: 
+       REAL(wp)     ::  kmzp  !: 
+
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  vsus  !: 
        !$acc declare create ( vsus )
 
@@ -273,10 +284,10 @@
 !--    if neccessary
        IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes_acc( vsus, 0.0, 1.0, 0.0, 0.0, nzb_v_inner, &
-                                nzb_v_outer, wall_v )
-       ENDIF
-
-       !$acc kernels present ( u, v, w, km, tend, vsws, vswst )   &
-       !$acc         present ( ddzu, ddzw, fxm, fxp, wall_v )           &
+          CALL wall_fluxes_acc( vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp,          &
+                                nzb_v_inner, nzb_v_outer, wall_v )
+       ENDIF
+
+       !$acc kernels present ( u, v, w, km, tend, vsws, vswst )                &
+       !$acc         present ( ddzu, ddzw, fxm, fxp, wall_v )                  &
        !$acc         present ( nzb_v_inner, nzb_v_outer, nzb_diff_v )
        DO  i = i_left, i_right
@@ -288,7 +299,7 @@
 !
 !--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmxp = 0.25 * &
+                   kmxp = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j,i+1)+km(k,j-1,i)+km(k,j-1,i+1) )
-                   kmxm = 0.25 * &
+                   kmxm = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j,i-1)+km(k,j-1,i)+km(k,j-1,i-1) )
 
@@ -309,10 +320,10 @@
 !--          Wall functions at the left and right walls, respectively
              DO  k = 1, nzt
-                IF( k > nzb_v_inner(j,i)  .AND.  k <= nzb_v_outer(j,i)  .AND. &
+                IF( k > nzb_v_inner(j,i)  .AND.  k <= nzb_v_outer(j,i)  .AND.  &
                     wall_v(j,i) /= 0.0 )  THEN
 
-                   kmxp = 0.25 * &
+                   kmxp = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j,i+1)+km(k,j-1,i)+km(k,j-1,i+1) )
-                   kmxm = 0.25 * &
+                   kmxm = 0.25 *                                               &
                           ( km(k,j,i)+km(k,j,i-1)+km(k,j-1,i)+km(k,j-1,i-1) )
                    
@@ -342,7 +353,7 @@
 !
 !--                Interpolate eddy diffusivities on staggered gridpoints
-                   kmzp = 0.25 * &
+                   kmzp = 0.25 *                                               &
                           ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
-                   kmzm = 0.25 * &
+                   kmzm = 0.25 *                                               &
                           ( km(k,j,i)+km(k-1,j,i)+km(k,j-1,i)+km(k-1,j-1,i) )
 
@@ -367,5 +378,5 @@
 !--    Difference quotient of the momentum flux is not formed over
 !--    half of the grid spacing (2.0*ddzw(k)) any more, since the
-!--    comparison with other (LES) modell showed that the values of
+!--    comparison with other (LES) models showed that the values of
 !--    the momentum flux becomes too large in this case.
 !--    The term containing w(k-1,..) (see above equation) is removed here
@@ -379,14 +390,14 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25 * &
+                kmzp = 0.25 *                                                  &
                        ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
-                kmzm = 0.25 * &
+                kmzm = 0.25 *                                                  &
                        ( km(k,j,i)+km(k-1,j,i)+km(k,j-1,i)+km(k-1,j-1,i) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & + ( kmzp * ( w(k,j,i) - w(k,j-1,i)     ) * ddy       &
-                      &   ) * ddzw(k)                                        &
-                      & + ( kmzp * ( v(k+1,j,i) - v(k,j,i)     ) * ddzu(k+1) &
-                      &   + vsws(j,i)                                        &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & + ( kmzp * ( w(k,j,i) - w(k,j-1,i)     ) * ddy         &
+                      &   ) * ddzw(k)                                          &
+                      & + ( kmzp * ( v(k+1,j,i) - v(k,j,i)     ) * ddzu(k+1)   &
+                      &   + vsws(j,i)                                          &
                       &   ) * ddzw(k)
              ENDDO
@@ -407,14 +418,14 @@
 !
 !--             Interpolate eddy diffusivities on staggered gridpoints
-                kmzp = 0.25 * &
+                kmzp = 0.25 *                                                  &
                        ( km(k,j,i)+km(k+1,j,i)+km(k,j-1,i)+km(k+1,j-1,i) )
-                kmzm = 0.25 * &
+                kmzm = 0.25 *                                                  &
                        ( km(k,j,i)+km(k-1,j,i)+km(k,j-1,i)+km(k-1,j-1,i) )
 
-                tend(k,j,i) = tend(k,j,i)                                    &
-                      & - ( kmzm *  ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy      &
-                      &   ) * ddzw(k)                                        &
-                      & + ( -vswst(j,i)                                      &
-                      &   - kmzm * ( v(k,j,i)   - v(k-1,j,i)    ) * ddzu(k)  &
+                tend(k,j,i) = tend(k,j,i)                                      &
+                      & - ( kmzm *  ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy        &
+                      &   ) * ddzw(k)                                          &
+                      & + ( -vswst(j,i)                                        &
+                      &   - kmzm * ( v(k,j,i)   - v(k-1,j,i)    ) * ddzu(k)    &
                       &   ) * ddzw(k)
              ENDDO
@@ -432,15 +443,29 @@
     SUBROUTINE diffusion_v_ij( i, j )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, ddzw, km, tend, u, v, vsws, vswst, w
+       
+       USE control_parameters,                                                 &
+           ONLY:  constant_top_momentumflux, use_surface_fluxes, use_top_fluxes
+       
+       USE grid_variables,                                                     &
+           ONLY:  ddx, ddy, ddy2, fxm, fxp, wall_v
+       
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_diff_v, nzb_v_inner, nzb_v_outer, nzt, nzt_diff
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  kmxm, kmxp, kmzm, kmzp
-
-       REAL, DIMENSION(nzb:nzt+1) ::  vsus
+       INTEGER(iwp) ::  i     !: 
+       INTEGER(iwp) ::  j     !: 
+       INTEGER(iwp) ::  k     !: 
+       REAL(wp)     ::  kmxm  !: 
+       REAL(wp)     ::  kmxp  !: 
+       REAL(wp)     ::  kmzm  !: 
+       REAL(wp)     ::  kmzp  !: 
+
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  vsus  !: 
 
 !
@@ -452,13 +477,13 @@
           kmxm = 0.25 * ( km(k,j,i)+km(k,j,i-1)+km(k,j-1,i)+km(k,j-1,i-1) )
 
-          tend(k,j,i) = tend(k,j,i)                                          &
-                      & + ( kmxp * ( v(k,j,i+1) - v(k,j,i)     ) * ddx       &
-                      &   + kmxp * ( u(k,j,i+1) - u(k,j-1,i+1) ) * ddy       &
-                      &   - kmxm * ( v(k,j,i) - v(k,j,i-1) ) * ddx           &
-                      &   - kmxm * ( u(k,j,i) - u(k,j-1,i) ) * ddy           &
-                      &   ) * ddx                                            &
-                      & + 2.0 * (                                            &
-                      &           km(k,j,i)   * ( v(k,j+1,i) - v(k,j,i) )    &
-                      &         - km(k,j-1,i) * ( v(k,j,i) - v(k,j-1,i) )    &
+          tend(k,j,i) = tend(k,j,i)                                            &
+                      & + ( kmxp * ( v(k,j,i+1) - v(k,j,i)     ) * ddx         &
+                      &   + kmxp * ( u(k,j,i+1) - u(k,j-1,i+1) ) * ddy         &
+                      &   - kmxm * ( v(k,j,i) - v(k,j,i-1) ) * ddx             &
+                      &   - kmxm * ( u(k,j,i) - u(k,j-1,i) ) * ddy             &
+                      &   ) * ddx                                              &
+                      & + 2.0 * (                                              &
+                      &           km(k,j,i)   * ( v(k,j+1,i) - v(k,j,i) )      &
+                      &         - km(k,j-1,i) * ( v(k,j,i) - v(k,j-1,i) )      &
                       &         ) * ddy2
        ENDDO
@@ -470,11 +495,11 @@
 !
 !--       Calculate the horizontal momentum flux v'u'
-          CALL wall_fluxes( i, j, nzb_v_inner(j,i)+1, nzb_v_outer(j,i), &
-                            vsus, 0.0, 1.0, 0.0, 0.0 )
+          CALL wall_fluxes( i, j, nzb_v_inner(j,i)+1, nzb_v_outer(j,i),        &
+                            vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp )
 
           DO  k = nzb_v_inner(j,i)+1, nzb_v_outer(j,i)
-             kmxp = 0.25 * &
+             kmxp = 0.25 *                                                     &
                     ( km(k,j,i)+km(k,j,i+1)+km(k,j-1,i)+km(k,j-1,i+1) )
-             kmxm = 0.25 * &
+             kmxm = 0.25 *                                                     &
                     ( km(k,j,i)+km(k,j,i-1)+km(k,j-1,i)+km(k,j-1,i-1) )
 
@@ -506,11 +531,11 @@
           kmzm = 0.25 * ( km(k,j,i)+km(k-1,j,i)+km(k,j-1,i)+km(k-1,j-1,i) )
 
-          tend(k,j,i) = tend(k,j,i)                                          &
-                      & + ( kmzp * ( ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)   &
-                      &            + ( w(k,j,i) - w(k,j-1,i) ) * ddy         &
-                      &            )                                         &
-                      &   - kmzm * ( ( v(k,j,i)   - v(k-1,j,i)   ) * ddzu(k) &
-                      &            + ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy     &
-                      &            )                                         &
+          tend(k,j,i) = tend(k,j,i)                                            &
+                      & + ( kmzp * ( ( v(k+1,j,i) - v(k,j,i) ) * ddzu(k+1)     &
+                      &            + ( w(k,j,i) - w(k,j-1,i) ) * ddy           &
+                      &            )                                           &
+                      &   - kmzm * ( ( v(k,j,i)   - v(k-1,j,i)   ) * ddzu(k)   &
+                      &            + ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy       &
+                      &            )                                           &
                       &   ) * ddzw(k)
        ENDDO
@@ -522,5 +547,5 @@
 !--    Difference quotient of the momentum flux is not formed over half of
 !--    the grid spacing (2.0*ddzw(k)) any more, since the comparison with 
-!--    other (LES) modell showed that the values of the momentum flux becomes
+!--    other (LES) models showed that the values of the momentum flux becomes
 !--    too large in this case.
 !--    The term containing w(k-1,..) (see above equation) is removed here
@@ -533,9 +558,9 @@
           kmzm = 0.25 * ( km(k,j,i)+km(k-1,j,i)+km(k,j-1,i)+km(k-1,j-1,i) )
 
-          tend(k,j,i) = tend(k,j,i)                                          &
-                      & + ( kmzp * ( w(k,j,i) - w(k,j-1,i)     ) * ddy       &
-                      &   ) * ddzw(k)                                        &
-                      & + ( kmzp * ( v(k+1,j,i) - v(k,j,i)     ) * ddzu(k+1) &
-                      &   + vsws(j,i)                                        &
+          tend(k,j,i) = tend(k,j,i)                                            &
+                      & + ( kmzp * ( w(k,j,i) - w(k,j-1,i)     ) * ddy         &
+                      &   ) * ddzw(k)                                          &
+                      & + ( kmzp * ( v(k+1,j,i) - v(k,j,i)     ) * ddzu(k+1)   &
+                      &   + vsws(j,i)                                          &
                       &   ) * ddzw(k)
        ENDIF
@@ -553,9 +578,9 @@
                  ( km(k,j,i)+km(k-1,j,i)+km(k,j-1,i)+km(k-1,j-1,i) )
 
-          tend(k,j,i) = tend(k,j,i)                                          &
-                      & - ( kmzm *  ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy      &
-                      &   ) * ddzw(k)                                        &
-                      & + ( -vswst(j,i)                                      &
-                      &   - kmzm * ( v(k,j,i)   - v(k-1,j,i)    ) * ddzu(k)  &
+          tend(k,j,i) = tend(k,j,i)                                            &
+                      & - ( kmzm *  ( w(k-1,j,i) - w(k-1,j-1,i) ) * ddy        &
+                      &   ) * ddzw(k)                                          &
+                      & + ( -vswst(j,i)                                        &
+                      &   - kmzm * ( v(k,j,i)   - v(k-1,j,i)    ) * ddzu(k)    &
                       &   ) * ddzw(k)
        ENDIF
Index: /palm/trunk/SOURCE/diffusion_w.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_w.f90	(revision 1319)
+++ /palm/trunk/SOURCE/diffusion_w.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -48,24 +54,4 @@
 ! kmym_y/_z and kmyp_y/_z change to kmym and kmyp
 !
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng 
-!
-! 366 2009-08-25 08:06:27Z raasch
-! bc_lr/bc_ns replaced by bc_lr_cyc/bc_ns_cyc
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Wall functions now include diabatic conditions, call of routine wall_fluxes,
-! z0 removed from argument list
-!
-! 20 2007-02-26 00:12:32Z raasch
-! Bugfix: ddzw dimensioned 1:nzt"+1"
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.12  2006/02/23 10:38:03  raasch
-! nzb_2d replaced by nzb_w_outer, wall functions added for all vertical walls,
-! +z0 in argument list
-! WARNING: loops containing the MAX function are still not properly vectorized!
-!
 ! Revision 1.1  1997/09/12 06:24:11  raasch
 ! Initial revision
@@ -77,5 +63,6 @@
 !------------------------------------------------------------------------------!
 
-    USE wall_fluxes_mod
+    USE wall_fluxes_mod,                                                       &
+        ONLY :  wall_fluxes, wall_fluxes_acc
 
     PRIVATE
@@ -99,15 +86,31 @@
     SUBROUTINE diffusion_w
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &          
+           ONLY :  ddzu, ddzw, km, tend, u, v, w
+           
+       USE control_parameters,                                                 & 
+           ONLY :  topography
+           
+       USE grid_variables,                                                     &     
+           ONLY :  ddx, ddy, fwxm, fwxp, fwym, fwyp, wall_w_x, wall_w_y
+           
+       USE indices,                                                            &            
+           ONLY :  nxl, nxr, nyn, nys, nzb, nzb_w_inner, nzb_w_outer, nzt
+           
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  kmxm, kmxp, kmym, kmyp
-
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsus, wsvs
+       INTEGER(iwp) ::  i     !:
+       INTEGER(iwp) ::  j     !:
+       INTEGER(iwp) ::  k     !:
+       
+       REAL(wp) ::  kmxm  !:
+       REAL(wp) ::  kmxp  !:
+       REAL(wp) ::  kmym  !:
+       REAL(wp) ::  kmyp  !: 
+
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsus  !:
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsvs  !:
 
 
@@ -116,7 +119,7 @@
 !--    walls, if neccessary
        IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes( wsus, 0.0, 0.0, 0.0, 1.0, nzb_w_inner, &
+          CALL wall_fluxes( wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp, nzb_w_inner,             &
                             nzb_w_outer, wall_w_x )
-          CALL wall_fluxes( wsvs, 0.0, 0.0, 1.0, 0.0, nzb_w_inner, &
+          CALL wall_fluxes( wsvs, 0.0_wp, 0.0_wp, 1.0_wp, 0.0_wp, nzb_w_inner,             &
                             nzb_w_outer, wall_w_y )
        ENDIF
@@ -208,15 +211,32 @@
     SUBROUTINE diffusion_w_acc
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY :  ddzu, ddzw, km, tend, u, v, w
+           
+       USE control_parameters,                                                 &
+           ONLY :  topography
+           
+       USE grid_variables,                                                     &
+           ONLY : ddx, ddy, fwxm, fwxp, fwym, fwyp, wall_w_x, wall_w_y
+           
+       USE indices,                                                            &
+           ONLY :  i_left, i_right, j_north, j_south, nxl, nxr, nyn, nys, nzb, &
+                   nzb_w_inner, nzb_w_outer, nzt
+                   
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  kmxm, kmxp, kmym, kmyp
-
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsus, wsvs
+       INTEGER(iwp) ::  i     !:
+       INTEGER(iwp) ::  j     !:
+       INTEGER(iwp) ::  k     !:
+       
+       REAL(wp) ::  kmxm  !:
+       REAL(wp) ::  kmxp  !:
+       REAL(wp) ::  kmym  !:
+       REAL(wp) ::  kmyp  !: 
+
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsus  !:
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsvs  !:
        !$acc declare create ( wsus, wsvs )
 
@@ -225,8 +245,8 @@
 !--    walls, if neccessary
        IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes_acc( wsus, 0.0, 0.0, 0.0, 1.0, nzb_w_inner, &
-                                nzb_w_outer, wall_w_x )
-          CALL wall_fluxes_acc( wsvs, 0.0, 0.0, 1.0, 0.0, nzb_w_inner, &
-                                nzb_w_outer, wall_w_y )
+          CALL wall_fluxes_acc( wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp,          &
+                                nzb_w_inner, nzb_w_outer, wall_w_x )
+          CALL wall_fluxes_acc( wsvs, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp,          &
+                                nzb_w_inner, nzb_w_outer, wall_w_y )
        ENDIF
 
@@ -324,15 +344,31 @@
     SUBROUTINE diffusion_w_ij( i, j )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &          
+           ONLY :  ddzu, ddzw, km, tend, u, v, w
+           
+       USE control_parameters,                                                 & 
+           ONLY :  topography
+           
+       USE grid_variables,                                                     &     
+           ONLY :  ddx, ddy, fwxm, fwxp, fwym, fwyp, wall_w_x, wall_w_y
+           
+       USE indices,                                                            &            
+           ONLY :  nxl, nxr, nyn, nys, nzb, nzb_w_inner, nzb_w_outer, nzt
+           
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  kmxm, kmxp, kmym, kmyp
-
-       REAL, DIMENSION(nzb:nzt+1) ::  wsus, wsvs
+       INTEGER(iwp) ::  i     !:
+       INTEGER(iwp) ::  j     !:
+       INTEGER(iwp) ::  k     !:
+       
+       REAL(wp) ::  kmxm  !:
+       REAL(wp) ::  kmxp  !:
+       REAL(wp) ::  kmym  !:
+       REAL(wp) ::  kmyp  !: 
+
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  wsus
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  wsvs
 
 
@@ -369,6 +405,6 @@
 !--       Calculate the horizontal momentum fluxes w'u' and/or w'v'
           IF ( wall_w_x(j,i) /= 0.0 )  THEN
-             CALL wall_fluxes( i, j, nzb_w_inner(j,i)+1, nzb_w_outer(j,i), &
-                               wsus, 0.0, 0.0, 0.0, 1.0 )
+             CALL wall_fluxes( i, j, nzb_w_inner(j,i)+1, nzb_w_outer(j,i),     &
+                               wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp )
           ELSE
              wsus = 0.0
@@ -376,6 +412,6 @@
 
           IF ( wall_w_y(j,i) /= 0.0 )  THEN
-             CALL wall_fluxes( i, j, nzb_w_inner(j,i)+1, nzb_w_outer(j,i),  &
-                               wsvs, 0.0, 0.0, 1.0, 0.0 )
+             CALL wall_fluxes( i, j, nzb_w_inner(j,i)+1, nzb_w_outer(j,i),     &
+                               wsvs, 0.0_wp, 0.0_wp, 1.0_wp, 0.0_wp )
           ELSE
              wsvs = 0.0
Index: /palm/trunk/SOURCE/diffusivities.f90
===================================================================
--- /palm/trunk/SOURCE/diffusivities.f90	(revision 1319)
+++ /palm/trunk/SOURCE/diffusivities.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -36,26 +42,4 @@
 ! adjustment of mixing length to the Prandtl mixing length at first grid point
 ! above ground removed
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 137 2007-11-28 08:50:10Z letzel
-! Bugfix for summation of sums_l_l for flow_statistics
-! Vertical scalar profiles now based on nzb_s_inner and ngp_2dh_s_inner.
-!
-! 97 2007-06-21 08:23:15Z raasch
-! Adjustment of mixing length calculation for the ocean version.
-! This is also a bugfix, because the height above the topography is now
-! used instead of the height above level k=0.
-! theta renamed var, dpt_dz renamed dvar_dz, +new argument var_reference
-! use_pt_reference renamed use_reference
-!
-! 57 2007-03-09 12:05:41Z raasch
-! Reference temperature pt_reference can be used in buoyancy term
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.24  2006/04/26 12:16:26  raasch
-! OpenMP optimization (+sums_l_l_t), sqrt_e must be private
 !
 ! Revision 1.1  1997/09/19 07:41:10  raasch
@@ -69,18 +53,37 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  dd2zu, e, kh, km, l_grid, l_wall
+        
+    USE control_parameters,                                                    &
+        ONLY:  atmos_ocean_sign, e_min, g, outflow_l, outflow_n, outflow_r,    &
+                outflow_s, use_single_reference_value, wall_adjustment
+                
+    USE indices,                                                               &
+        ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb_s_inner, nzb, nzt
+    USE kinds
+    
     USE pegrid
-    USE statistics
+    
+    USE statistics,                                                            &
+        ONLY :  rmask, statistic_regions, sums_l_l
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, omp_get_thread_num, sr, tn
-
-    REAL    ::  dvar_dz, l, ll, l_stable, sqrt_e, var_reference
-
-    REAL    ::  var(nzb:nzt+1,nysg:nyng,nxlg:nxrg)
+    INTEGER(iwp) ::  i                   !:
+    INTEGER(iwp) ::  j                   !:
+    INTEGER(iwp) ::  k                   !:
+    INTEGER(iwp) ::  omp_get_thread_num  !:
+    INTEGER(iwp) ::  sr                  !:
+    INTEGER(iwp) ::  tn                  !:
+
+    REAL(wp)     ::  dvar_dz             !:
+    REAL(wp)     ::  l                   !:
+    REAL(wp)     ::  ll                  !:
+    REAL(wp)     ::  l_stable            !:
+    REAL(wp)     ::  sqrt_e              !:
+    REAL(wp)     ::  var_reference       !:
+
+    REAL(wp)     ::  var(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  !:
 
 
@@ -136,8 +139,8 @@
                 IF ( dvar_dz > 0.0 ) THEN
                    IF ( use_single_reference_value )  THEN
-                      l_stable = 0.76 * sqrt_e / &
+                      l_stable = 0.76 * sqrt_e /                               &
                                  SQRT( g / var_reference * dvar_dz ) + 1E-5
                    ELSE
-                      l_stable = 0.76 * sqrt_e / &
+                      l_stable = 0.76 * sqrt_e /                               &
                                  SQRT( g / var(k,j,i) * dvar_dz ) + 1E-5
                    ENDIF
Index: /palm/trunk/SOURCE/disturb_field.f90
===================================================================
--- /palm/trunk/SOURCE/disturb_field.f90	(revision 1319)
+++ /palm/trunk/SOURCE/disturb_field.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -26,24 +32,6 @@
 ! $Id$
 !
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
-!
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-! Calls of exchange_horiz are modified.
-!
-! 420 2010-01-13 15:10:53Z franke
-! Loop was split to make runs reproducible when using ifort compiler
-!
-! 75 2007-03-22 09:54:05Z raasch
-! xrp, ynp eliminated, 2nd+3rd argument removed from exchange horiz
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.11  2006/08/04 14:31:59  raasch
-! izuf renamed iran
 !
 ! Revision 1.1  1998/02/04 15:40:45  raasch
@@ -60,19 +48,35 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
-    USE random_function_mod
+    USE control_parameters,   &
+        ONLY:  dist_nxl, dist_nxr, dist_nyn, dist_nys, dist_range,             &
+               disturbance_amplitude, disturbance_created,                     &
+               disturbance_level_ind_b, disturbance_level_ind_t, iran,         &
+               random_generator, topography
+                
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+        
+    USE indices,                                                               &
+        ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
+        
+    USE kinds
+    
+    USE random_function_mod,                                                   &
+        ONLY: random_function
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k
-    INTEGER ::  nzb_uv_inner(nysg:nyng,nxlg:nxrg)
-
-    REAL    ::  randomnumber,                             &
-                dist1(nzb:nzt+1,nysg:nyng,nxlg:nxrg), &
-                field(nzb:nzt+1,nysg:nyng,nxlg:nxrg)
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  dist2
+    INTEGER(iwp) ::  i  !:
+    INTEGER(iwp) ::  j  !:
+    INTEGER(iwp) ::  k  !:
+    
+    INTEGER(iwp) ::  nzb_uv_inner(nysg:nyng,nxlg:nxrg) !:
+
+    REAL(wp) ::  randomnumber  !:
+    
+    REAL(wp) ::  dist1(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  !:
+    REAL(wp) ::  field(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  !:
+    
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  dist2  !:
 
 
@@ -92,8 +96,8 @@
           DO  j = dist_nys(dist_range), dist_nyn(dist_range)
              DO  k = disturbance_level_ind_b, disturbance_level_ind_t
-                randomnumber = 3.0 * disturbance_amplitude * &
+                randomnumber = 3.0 * disturbance_amplitude *                   &
                                ( random_function( iran ) - 0.5 )
-                IF ( nxl <= i  .AND.  nxr >= i  .AND.  nys <= j  .AND.  &
-                     nyn >= j ) &
+                IF ( nxl <= i  .AND.  nxr >= i  .AND.  nys <= j  .AND.         &
+                     nyn >= j )                                                &
                 THEN
                    dist1(k,j,i) = randomnumber
@@ -107,12 +111,12 @@
              DO  k = disturbance_level_ind_b, disturbance_level_ind_t
 #if defined( __nec )
-                randomnumber = 3.0 * disturbance_amplitude * &
+                randomnumber = 3.0 * disturbance_amplitude *                   &
                                ( RANDOM( 0 ) - 0.5 )
 #else
                 CALL RANDOM_NUMBER( randomnumber )
-                randomnumber = 3.0 * disturbance_amplitude * &
+                randomnumber = 3.0 * disturbance_amplitude *                   &
                                 ( randomnumber - 0.5 )
 #endif
-                IF ( nxl <= i .AND. nxr >= i .AND. nys <= j .AND. nyn >= j ) &
+                IF ( nxl <= i .AND. nxr >= i .AND. nys <= j .AND. nyn >= j )   &
                 THEN
                    dist1(k,j,i) = randomnumber
@@ -137,6 +141,6 @@
         DO  j = nys, nyn
           DO  k = disturbance_level_ind_b-1, disturbance_level_ind_t+1
-             dist2(k,j,i) = ( dist1(k,j,i-1) + dist1(k,j,i+1) &
-                            + dist1(k,j+1,i) + dist1(k+1,j,i) &
+             dist2(k,j,i) = ( dist1(k,j,i-1) + dist1(k,j,i+1)                  &
+                            + dist1(k,j+1,i) + dist1(k+1,j,i)                  &
                             ) / 12.0
           ENDDO
Index: /palm/trunk/SOURCE/disturb_heatflux.f90
===================================================================
--- /palm/trunk/SOURCE/disturb_heatflux.f90	(revision 1319)
+++ /palm/trunk/SOURCE/disturb_heatflux.f90	(revision 1320)
@@ -16,9 +16,15 @@
 !
 ! Copyright 1997-2014 Leibniz Universitaet Hannover
-!--------------------------------------------------------------------------------!
+!------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -26,18 +32,6 @@
 ! $Id$
 !
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
-!
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 555 2010-09-07 07:32:53Z raasch
-! Bugfix in if statement
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.7  2006/08/04 14:35:07  raasch
-! Additional parameter in function random_gauss which limits the range of the
-! created random numbers, izuf renamed iran
 !
 ! Revision 1.1  1998/03/25 20:03:47  raasch
@@ -54,14 +48,25 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  shf
+        
+    USE control_parameters,                                                    &
+        ONLY:  iran, surface_heatflux, wall_heatflux
+        
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+        
+    USE kinds
+    
+    USE indices,                                                               &
+        ONLY:  nx, nxl, nxr, ny, nyn, nys, nzb_s_inner
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j
-    REAL    ::  random_gauss, randomnumber
+    INTEGER(iwp) ::  j  !:
+    INTEGER(iwp) ::  i  !:
+    
+    REAL(wp) ::  random_gauss  !:
+    REAL(wp) ::  randomnumber  !:
 
 
@@ -73,5 +78,5 @@
        DO  j = 0, ny
           randomnumber = random_gauss( iran, 5.0 )
-          IF ( nxl <= i  .AND.  nxr >= i  .AND.  nys <= j  .AND.  nyn >= j ) &
+          IF ( nxl <= i  .AND.  nxr >= i  .AND.  nys <= j  .AND.  nyn >= j )   &
           THEN
              IF ( nzb_s_inner(j,i) == 0 )  THEN
Index: /palm/trunk/SOURCE/eqn_state_seawater.f90
===================================================================
--- /palm/trunk/SOURCE/eqn_state_seawater.f90	(revision 1319)
+++ /palm/trunk/SOURCE/eqn_state_seawater.f90	(revision 1320)
@@ -1,5 +1,5 @@
  MODULE eqn_state_seawater_mod
 
-!--------------------------------------------------------------------------------!
+!------------------------------------------------------------------------------!
 ! This file is part of PALM.
 !
@@ -16,9 +16,15 @@
 !
 ! Copyright 1997-2014 Leibniz Universitaet Hannover
-!--------------------------------------------------------------------------------!
+!------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -28,8 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 388 2009-09-23 09:40:33Z raasch
-! Potential density is additionally calculated in eqn_state_seawater,
-! first constant in array den also defined as type double.
 !
 ! 97 2007-06-21 08:23:15Z raasch
@@ -45,4 +47,6 @@
 ! eqn_state_seawater_func calculates density.
 !------------------------------------------------------------------------------!
+    
+    USE kinds
 
     IMPLICIT NONE
@@ -51,20 +55,22 @@
     PUBLIC eqn_state_seawater, eqn_state_seawater_func
 
-    REAL, DIMENSION(12), PARAMETER ::  nom =                             &
-                      (/ 9.9984085444849347D2,   7.3471625860981584D0,   &
-                        -5.3211231792841769D-2,  3.6492439109814549D-4,  &
-                         2.5880571023991390D0,  -6.7168282786692354D-3,  &
-                         1.9203202055760151D-3,  1.1798263740430364D-2,  &
-                         9.8920219266399117D-8,  4.6996642771754730D-6,  &
-                        -2.5862187075154352D-8, -3.2921414007960662D-12 /)
-
-    REAL, DIMENSION(13), PARAMETER ::  den =                             &
-                      (/ 1.0D0,                  7.2815210113327091D-3,  &
-                        -4.4787265461983921D-5,  3.3851002965802430D-7,  &
-                         1.3651202389758572D-10, 1.7632126669040377D-3,  &
-                        -8.8066583251206474D-6, -1.8832689434804897D-10, &
-                         5.7463776745432097D-6,  1.4716275472242334D-9,  &
-                         6.7103246285651894D-6, -2.4461698007024582D-17, &
-                        -9.1534417604289062D-18 /)
+    REAL(wp), DIMENSION(12), PARAMETER ::  nom =                               &
+                          (/ 9.9984085444849347D2,   7.3471625860981584D0,     &
+                            -5.3211231792841769D-2,  3.6492439109814549D-4,    &
+                             2.5880571023991390D0,  -6.7168282786692354D-3,    &
+                             1.9203202055760151D-3,  1.1798263740430364D-2,    &
+                             9.8920219266399117D-8,  4.6996642771754730D-6,    &
+                            -2.5862187075154352D-8, -3.2921414007960662D-12 /)
+                          !:
+
+    REAL(wp), DIMENSION(13), PARAMETER ::  den =                               &
+                          (/ 1.0D0,                  7.2815210113327091D-3,    &
+                            -4.4787265461983921D-5,  3.3851002965802430D-7,    &
+                             1.3651202389758572D-10, 1.7632126669040377D-3,    &
+                            -8.8066583251206474D-6, -1.8832689434804897D-10,   &
+                             5.7463776745432097D-6,  1.4716275472242334D-9,    &
+                             6.7103246285651894D-6, -2.4461698007024582D-17,   &
+                            -9.1534417604289062D-18 /)
+                          !:
 
     INTERFACE eqn_state_seawater
@@ -85,12 +91,29 @@
     SUBROUTINE eqn_state_seawater
 
-       USE arrays_3d
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  hyp, prho, pt_p, rho, sa_p
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb_s_inner, nzt
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL ::  pden, pnom, p1, p2, p3, pt1, pt2, pt3, pt4, sa1, sa15, sa2
+       INTEGER(iwp) ::  i  !:
+       INTEGER(iwp) ::  j  !:
+       INTEGER(iwp) ::  k  !:
+
+       REAL(wp) ::  pden  !:
+       REAL(wp) ::  pnom  !:
+       REAL(wp) ::  p1    !:
+       REAL(wp) ::  p2    !:
+       REAL(wp) ::  p3    !:
+       REAL(wp) ::  pt1   !:
+       REAL(wp) ::  pt2   !:
+       REAL(wp) ::  pt3   !:
+       REAL(wp) ::  pt4   !:
+       REAL(wp) ::  sa1   !:
+       REAL(wp) ::  sa15  !:
+       REAL(wp) ::  sa2   !:
+       
+                       
 
        DO  i = nxl, nxr
@@ -114,11 +137,11 @@
                 sa2  = sa1 * sa1
 
-                pnom = nom(1)           + nom(2)*pt1     + nom(3)*pt2     + &
-                       nom(4)*pt3       + nom(5)*sa1     + nom(6)*sa1*pt1 + &
+                pnom = nom(1)           + nom(2)*pt1     + nom(3)*pt2     +    &
+                       nom(4)*pt3       + nom(5)*sa1     + nom(6)*sa1*pt1 +    &
                        nom(7)*sa2
 
-                pden = den(1)           + den(2)*pt1     + den(3)*pt2     + &
-                       den(4)*pt3       + den(5)*pt4     + den(6)*sa1     + &
-                       den(7)*sa1*pt1   + den(8)*sa1*pt3 + den(9)*sa15    + &
+                pden = den(1)           + den(2)*pt1     + den(3)*pt2     +    &
+                       den(4)*pt3       + den(5)*pt4     + den(6)*sa1     +    &
+                       den(7)*sa1*pt1   + den(8)*sa1*pt3 + den(9)*sa15    +    &
                        den(10)*sa15*pt2
 
@@ -127,8 +150,8 @@
                 prho(k,j,i) = pnom / pden
 
-                pnom = pnom +             nom(8)*p1      + nom(9)*p1*pt2  + &
+                pnom = pnom +             nom(8)*p1      + nom(9)*p1*pt2  +    &
                        nom(10)*p1*sa1   + nom(11)*p2     + nom(12)*p2*pt2
 
-                pden = pden +             den(11)*p1     + den(12)*p2*pt3 + &
+                pden = pden +             den(11)*p1     + den(12)*p2*pt3 +    &
                        den(13)*p3*pt1
 
@@ -156,12 +179,16 @@
     SUBROUTINE eqn_state_seawater_ij( i, j )
 
-       USE arrays_3d
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  hyp, prho, pt_p, rho, sa_p
+           
+       USE indices,                                                            &
+           ONLY:  nzb_s_inner, nzt
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL ::  pden, pnom, p1, p2, p3, pt1, pt2, pt3, pt4, sa1, sa15, sa2
+       INTEGER(iwp) ::  i, j, k
+
+       REAL(wp)     ::  pden, pnom, p1, p2, p3, pt1, pt2, pt3, pt4, sa1, sa15, &
+                        sa2
 
        DO  k = nzb_s_inner(j,i)+1, nzt
@@ -183,11 +210,11 @@
           sa2  = sa1 * sa1
 
-          pnom = nom(1)           + nom(2)*pt1     + nom(3)*pt2     + &
-                 nom(4)*pt3       + nom(5)*sa1     + nom(6)*sa1*pt1 + &
+          pnom = nom(1)           + nom(2)*pt1     + nom(3)*pt2     +          &
+                 nom(4)*pt3       + nom(5)*sa1     + nom(6)*sa1*pt1 +          &
                  nom(7)*sa2
 
-          pden = den(1)           + den(2)*pt1     + den(3)*pt2     + &
-                 den(4)*pt3       + den(5)*pt4     + den(6)*sa1     + &
-                 den(7)*sa1*pt1   + den(8)*sa1*pt3 + den(9)*sa15    + &
+          pden = den(1)           + den(2)*pt1     + den(3)*pt2     +          &
+                 den(4)*pt3       + den(5)*pt4     + den(6)*sa1     +          &
+                 den(7)*sa1*pt1   + den(8)*sa1*pt3 + den(9)*sa15    +          &
                  den(10)*sa15*pt2
 
@@ -196,7 +223,7 @@
           prho(k,j,i) = pnom / pden
 
-          pnom = pnom +             nom(8)*p1      + nom(9)*p1*pt2  + &
+          pnom = pnom +             nom(8)*p1      + nom(9)*p1*pt2  +          &
                  nom(10)*p1*sa1   + nom(11)*p2     + nom(12)*p2*pt2
-          pden = pden +             den(11)*p1     + den(12)*p2*pt3 + &
+          pden = pden +             den(11)*p1     + den(12)*p2*pt3 +          &
                  den(13)*p3*pt1
 
@@ -221,9 +248,20 @@
 ! Equation of state as a function
 !------------------------------------------------------------------------------!
-    REAL FUNCTION eqn_state_seawater_func( p, pt, sa )
+    REAL(wp) FUNCTION eqn_state_seawater_func( p, pt, sa )
 
        IMPLICIT NONE
 
-       REAL ::  p, p1, p2, p3, pt, pt1, pt2, pt3, pt4, sa, sa15, sa2
+       REAL(wp) ::  p      !:
+       REAL(wp) ::  p1     !:
+       REAL(wp) ::  p2     !:
+       REAL(wp) ::  p3     !:
+       REAL(wp) ::  pt     !:
+       REAL(wp) ::  pt1    !:
+       REAL(wp) ::  pt2    !:
+       REAL(wp) ::  pt3    !:
+       REAL(wp) ::  pt4    !:
+       REAL(wp) ::  sa     !:
+       REAL(wp) ::  sa15   !:
+       REAL(wp) ::  sa2    !:
 
 !
Index: /palm/trunk/SOURCE/exchange_horiz.f90
===================================================================
--- /palm/trunk/SOURCE/exchange_horiz.f90	(revision 1319)
+++ /palm/trunk/SOURCE/exchange_horiz.f90	(revision 1320)
@@ -1,5 +1,5 @@
  SUBROUTINE exchange_horiz( ar, nbgp_local)
 
-!--------------------------------------------------------------------------------!
+!------------------------------------------------------------------------------!
 ! This file is part of PALM.
 !
@@ -16,16 +16,19 @@
 !
 ! Copyright 1997-2014 Leibniz Universitaet Hannover
-!--------------------------------------------------------------------------------!
+!------------------------------------------------------------------------------!
 !
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
 ! -----------------
 ! $Id$
-!
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
 !
 ! 1257 2013-11-08 15:18:40Z raasch
@@ -45,35 +48,4 @@
 ! 841 2012-02-28 12:29:49Z maronga
 ! Excluded routine from compilation of namelist_file_check
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 707 2011-03-29 11:39:40Z raasch
-! grid_level directly used as index for MPI data type arrays,
-! bc_lr/ns replaced by bc_lr/ns_cyc
-!
-! 689 2011-02-20 19:31:12z gryschka 
-! Bugfix for some logical expressions 
-! (syntax was not compatible with all compilers)
-!
-! 683 2011-02-09 14:25:15Z raasch
-! optional synchronous exchange (sendrecv) implemented, code partly reformatted
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Dynamic exchange of ghost points with nbgp_local to ensure that no useless 
-! ghost points exchanged in case of multigrid. type_yz(0) and type_xz(0)
-! used for normal grid, the remaining types used for the several grid levels.
-! Exchange is done via MPI-Vectors with a dynamic value of ghost points which
-! depend on the advection scheme. Exchange of left and right PEs is 10% faster 
-! with MPI-Vectors than without.
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Special cases for additional gridpoints along x or y in case of non-cyclic
-! boundary conditions are not regarded any more
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.16  2006/02/23 12:19:08  raasch
-! anz_yz renamed ngp_yz
 !
 ! Revision 1.1  1997/07/24 11:13:29  raasch
@@ -87,7 +59,16 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE cpulog
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, mg_switch_to_pe0,             &
+               synchronous_exchange
+                
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+        
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
+        
+    USE kinds
+    
     USE pegrid
 
@@ -95,7 +76,12 @@
 
 
-    INTEGER ::  i, j, k, nbgp_local
-    REAL, DIMENSION(nzb:nzt+1,nys-nbgp_local:nyn+nbgp_local, &
-                    nxl-nbgp_local:nxr+nbgp_local) ::  ar
+    INTEGER(iwp) ::  i           !:
+    INTEGER(iwp) ::  j           !:
+    INTEGER(iwp) ::  k           !:
+    INTEGER(iwp) ::  nbgp_local  !:
+    
+    REAL(wp), DIMENSION(nzb:nzt+1,nys-nbgp_local:nyn+nbgp_local,               &
+                        nxl-nbgp_local:nxr+nbgp_local) ::  ar  !:
+                        
 
 #if ! defined( __check )
@@ -127,8 +113,8 @@
 !
 !--       Send right boundary, receive left one (synchronous)
-          CALL MPI_SENDRECV( ar(nzb,nys-nbgp_local,nxr+1-nbgp_local), 1, &
-                             type_yz(grid_level), pright, 1,             &
-                             ar(nzb,nys-nbgp_local,nxl-nbgp_local), 1,   &
-                             type_yz(grid_level), pleft,  1,             &
+          CALL MPI_SENDRECV( ar(nzb,nys-nbgp_local,nxr+1-nbgp_local), 1,       &
+                             type_yz(grid_level), pright, 1,                   &
+                             ar(nzb,nys-nbgp_local,nxl-nbgp_local), 1,         &
+                             type_yz(grid_level), pleft,  1,                   &
                              comm2d, status, ierr )
 
@@ -152,9 +138,9 @@
 !
 !--          Send right boundary, receive left one (asynchronous)
-             CALL MPI_ISEND( ar(nzb,nys-nbgp_local,nxr+1-nbgp_local), 1,          &
-                             type_yz(grid_level), pright, req_count+1, comm2d,    &
+             CALL MPI_ISEND( ar(nzb,nys-nbgp_local,nxr+1-nbgp_local), 1,       &
+                             type_yz(grid_level), pright, req_count+1, comm2d, &
                              req(req_count+3), ierr )
-             CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,          &
-                             type_yz(grid_level), pleft,  req_count+1, comm2d,    &
+             CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,       &
+                             type_yz(grid_level), pleft,  req_count+1, comm2d, &
                              req(req_count+4), ierr )
 
@@ -192,8 +178,8 @@
 !
 !--       Send rear boundary, receive front one (synchronous)
-          CALL MPI_SENDRECV( ar(nzb,nyn-nbgp_local+1,nxl-nbgp_local), 1, &
-                             type_xz(grid_level), pnorth, 1,             &
-                             ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1, &
-                             type_xz(grid_level), psouth, 1,             &
+          CALL MPI_SENDRECV( ar(nzb,nyn-nbgp_local+1,nxl-nbgp_local), 1,       &
+                             type_xz(grid_level), pnorth, 1,                   &
+                             ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,       &
+                             type_xz(grid_level), psouth, 1,                   &
                              comm2d, status, ierr )
 
@@ -218,9 +204,9 @@
 !
 !--          Send rear boundary, receive front one (asynchronous)
-             CALL MPI_ISEND( ar(nzb,nyn-nbgp_local+1,nxl-nbgp_local), 1,          &
-                             type_xz(grid_level), pnorth, req_count+1, comm2d,    &
+             CALL MPI_ISEND( ar(nzb,nyn-nbgp_local+1,nxl-nbgp_local), 1,       &
+                             type_xz(grid_level), pnorth, req_count+1, comm2d, &
                              req(req_count+3), ierr )
-             CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,          &
-                             type_xz(grid_level), psouth, req_count+1, comm2d,    &
+             CALL MPI_IRECV( ar(nzb,nys-nbgp_local,nxl-nbgp_local),   1,       &
+                             type_xz(grid_level), psouth, req_count+1, comm2d, &
                              req(req_count+4), ierr )
 
Index: /palm/trunk/SOURCE/exchange_horiz_2d.f90
===================================================================
--- /palm/trunk/SOURCE/exchange_horiz_2d.f90	(revision 1319)
+++ /palm/trunk/SOURCE/exchange_horiz_2d.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -26,7 +32,4 @@
 ! $Id$
 !
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
-!
 ! 1092 2013-02-02 11:24:22Z raasch
 ! unused variables removed
@@ -37,24 +40,4 @@
 ! 841 2012-02-28 12:29:49Z maronga
 ! Excluded routine from compilation of namelist_file_check
-!
-! 707 2011-03-29 11:39:40Z raasch
-! bc_lr/ns replaced by bc_lr/ns_cyc
-! 
-! 702 2011-03-24 19:33:15Z suehring
-! Bugfix in declaration of ar in exchange_horiz_2d_int and number of MPI-blocks
-! in MPI_SENDRECV().
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Dynamic exchange of ghost points with nbgp, which depends on the advection
-! scheme. Exchange between left and right PEs is now done with MPI-vectors.
-!
-! 73 2007-03-20 08:33:14Z raasch
-! Neumann boundary conditions at inflow/outflow in case of non-cyclic boundary
-! conditions
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.9  2006/05/12 19:15:52  letzel
-! MPI_REAL replaced by MPI_INTEGER in exchange_horiz_2d_int
 !
 ! Revision 1.1  1998/01/23 09:58:21  raasch
@@ -68,7 +51,16 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE cpulog
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY :  inflow_l, inflow_n, inflow_r, inflow_s, outflow_l, outflow_n,  &
+                outflow_r, outflow_s
+                
+    USE cpulog,                                                                &
+        ONLY :  cpu_log, log_point_s
+        
+    USE indices,                                                               &
+        ONLY :  nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg
+        
+    USE kinds
+    
     USE pegrid
 
@@ -76,6 +68,8 @@
 
 
-    REAL ::  ar(nysg:nyng,nxlg:nxrg)
-    INTEGER :: i
+    INTEGER(iwp) :: i  !:
+    
+    REAL(wp) ::  ar(nysg:nyng,nxlg:nxrg)  !:
+    
 
 #if ! defined( __check )
@@ -188,12 +182,20 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE cpulog
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  bc_lr_cyc, bc_ns_cyc
+        
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+        
+    USE indices,                                                               &
+        ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg
+        
+    USE kinds
+    
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER ::  ar(nysg:nyng,nxlg:nxrg)
+    INTEGER(iwp) ::  ar(nysg:nyng,nxlg:nxrg)  !:
 
 #if ! defined( __check )
Index: /palm/trunk/SOURCE/fft_xy.f90
===================================================================
--- /palm/trunk/SOURCE/fft_xy.f90	(revision 1319)
+++ /palm/trunk/SOURCE/fft_xy.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -65,24 +71,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 274 2009-03-26 15:11:21Z heinze
-! Output of messages replaced by message handling routine.
-!
-! Feb. 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.4  2006/03/28 12:27:09  raasch
-! Stop when system-specific fft is selected on NEC. For unknown reasons this
-! causes a program abort during first allocation in init_grid.
-!
-! Revision 1.2  2004/04/30 11:44:27  raasch
-! Module renamed from fft_for_1d_decomp to fft_xy, 1d-routines renamed to
-! fft_x and fft_y,
-! function FFT replaced by subroutine FFTN due to problems with 64-bit
-! mode on ibm,
-! shape of array cwork is explicitly stored in ishape/jshape and handled
-! to routine FFTN instead of shape-function (due to compiler error on
-! decalpha),
-! non vectorized FFT for nec included
 !
 ! Revision 1.1  2002/06/11 13:00:49  raasch
@@ -96,6 +82,10 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  fft_method, message_string
+        
+    USE indices,                                                               &
+        ONLY:  nx, ny, nz
+        
 #if defined( __cuda_fft )
     USE ISO_C_BINDING
@@ -103,8 +93,14 @@
     USE, INTRINSIC ::  ISO_C_BINDING
 #endif
-    USE precision_kind
-    USE singleton
+
+    USE kinds
+    
+    USE singleton,                                                             &
+        ONLY: fftn
+    
     USE temperton_fft
-    USE transpose_indices
+    
+    USE transpose_indices,                                                     &
+        ONLY:  nyn_x, nys_x, nzb_x, nzb_y, nzt_x, nzt_y
 
     IMPLICIT NONE
@@ -113,31 +109,62 @@
     PUBLIC fft_x, fft_x_1d, fft_y, fft_y_1d, fft_init, fft_x_m, fft_y_m
 
-    INTEGER, DIMENSION(:), ALLOCATABLE, SAVE ::  ifax_x, ifax_y
-
-    LOGICAL, SAVE                            ::  init_fft = .FALSE.
-
-    REAL, SAVE ::  dnx, dny, sqr_dnx, sqr_dny
-    REAL, DIMENSION(:), ALLOCATABLE, SAVE    ::  trigs_x, trigs_y
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE, SAVE ::  ifax_x  !:
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE, SAVE ::  ifax_y  !:
+
+    LOGICAL, SAVE ::  init_fft = .FALSE.  !:
+
+    REAL(wp), SAVE ::  dnx      !:
+    REAL(wp), SAVE ::  dny      !:
+    REAL(wp), SAVE ::  sqr_dnx  !:
+    REAL(wp), SAVE ::  sqr_dny  !:
+    
+    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  trigs_x  !: 
+    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  trigs_y  !:
 
 #if defined( __ibm )
-    INTEGER, PARAMETER ::  nau1 = 20000, nau2 = 22000
+    INTEGER(iwp), PARAMETER ::  nau1 = 20000  !: 
+    INTEGER(iwp), PARAMETER ::  nau2 = 22000  !:
 !
 !-- The following working arrays contain tables and have to be "save" and
 !-- shared in OpenMP sense
-    REAL, DIMENSION(nau1), SAVE ::  aux1, auy1, aux3, auy3
+    REAL(wp), DIMENSION(nau1), SAVE ::  aux1  !: 
+    REAL(wp), DIMENSION(nau1), SAVE ::  auy1  !:
+    REAL(wp), DIMENSION(nau1), SAVE ::  aux3  !: 
+    REAL(wp), DIMENSION(nau1), SAVE ::  auy3  !:
+    
 #elif defined( __nec )
-    INTEGER, SAVE ::  nz1
-    REAL, DIMENSION(:), ALLOCATABLE, SAVE ::  trig_xb, trig_xf, trig_yb, &
-                                              trig_yf
+    INTEGER(iwp), SAVE ::  nz1  !:
+    
+    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  trig_xb  !:
+    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  trig_xf  !: 
+    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  trig_yb  !:
+    REAL(wp), DIMENSION(:), ALLOCATABLE, SAVE ::  trig_yf  !:
+    
 #elif defined( __cuda_fft )
-    INTEGER(C_INT), SAVE ::  plan_xf, plan_xi, plan_yf, plan_yi
-    INTEGER, SAVE        ::  total_points_x_transpo, total_points_y_transpo
+    INTEGER(C_INT), SAVE ::  plan_xf  !:
+    INTEGER(C_INT), SAVE ::  plan_xi  !:
+    INTEGER(C_INT), SAVE ::  plan_yf  !:
+    INTEGER(C_INT), SAVE ::  plan_yi  !:
+    
+    INTEGER(iwp), SAVE   ::  total_points_x_transpo  !:
+    INTEGER(iwp), SAVE   ::  total_points_y_transpo  !:
 #endif
 
 #if defined( __fftw )
     INCLUDE  'fftw3.f03'
-    INTEGER(KIND=C_INT) ::  nx_c, ny_c
-    COMPLEX(KIND=C_DOUBLE_COMPLEX), DIMENSION(:), ALLOCATABLE, SAVE ::  x_out, y_out
-    REAL(KIND=C_DOUBLE), DIMENSION(:), ALLOCATABLE, SAVE            ::  x_in, y_in
+    INTEGER(KIND=C_INT) ::  nx_c  !:
+    INTEGER(KIND=C_INT) ::  ny_c  !:
+    
+    COMPLEX(KIND=C_DOUBLE_COMPLEX), DIMENSION(:), ALLOCATABLE, SAVE ::         &
+       x_out  !:
+    COMPLEX(KIND=C_DOUBLE_COMPLEX), DIMENSION(:), ALLOCATABLE, SAVE ::         &
+       y_out  !:
+    
+    REAL(KIND=C_DOUBLE), DIMENSION(:), ALLOCATABLE, SAVE ::                    &
+       x_in   !:
+    REAL(KIND=C_DOUBLE), DIMENSION(:), ALLOCATABLE, SAVE ::                    &
+       y_in   !:
+    
+    
     TYPE(C_PTR), SAVE ::  plan_xf, plan_xi, plan_yf, plan_yi
 #endif
@@ -186,12 +213,15 @@
 !--    in OpenMP sense
 #if defined( __ibm )
-       REAL, DIMENSION(0:nx+2) :: workx
-       REAL, DIMENSION(0:ny+2) :: worky
-       REAL, DIMENSION(nau2)   :: aux2, auy2, aux4, auy4
+       REAL(wp), DIMENSION(0:nx+2) ::  workx  !:
+       REAL(wp), DIMENSION(0:ny+2) ::  worky  !:
+       REAL(wp), DIMENSION(nau2)   ::  aux2   !: 
+       REAL(wp), DIMENSION(nau2)   ::  auy2   !: 
+       REAL(wp), DIMENSION(nau2)   ::  aux4   !: 
+       REAL(wp), DIMENSION(nau2)   ::  auy4   !:
 #elif defined( __nec )
-       REAL, DIMENSION(0:nx+3,nz+1)   ::  work_x
-       REAL, DIMENSION(0:ny+3,nz+1)   ::  work_y
-       REAL, DIMENSION(6*(nx+3),nz+1) ::  workx
-       REAL, DIMENSION(6*(ny+3),nz+1) ::  worky
+       REAL(wp), DIMENSION(0:nx+3,nz+1)   ::  work_x  !:
+       REAL(wp), DIMENSION(0:ny+3,nz+1)   ::  work_y  !:
+       REAL(wp), DIMENSION(6*(nx+3),nz+1) ::  workx   !:
+       REAL(wp), DIMENSION(6*(ny+3),nz+1) ::  worky   !:
 #endif 
 
@@ -228,5 +258,5 @@
           CALL message( 'fft_init', 'PA0187', 1, 2, 0, 6, 0 )
 
-          ALLOCATE( trig_xb(2*(nx+1)), trig_xf(2*(nx+1)), &
+          ALLOCATE( trig_xb(2*(nx+1)), trig_xf(2*(nx+1)),                      &
                     trig_yb(2*(ny+1)), trig_yf(2*(ny+1)) )
 
@@ -240,7 +270,7 @@
           CALL DZFFT( 0, nx+1, sqr_dnx, work_x, work_x, trig_xf, workx, 0 )
           CALL ZDFFT( 0, nx+1, sqr_dnx, work_x, work_x, trig_xb, workx, 0 )
-          CALL DZFFTM( 0, nx+1, nz1, sqr_dnx, work_x, nx+4, work_x, nx+4, &
+          CALL DZFFTM( 0, nx+1, nz1, sqr_dnx, work_x, nx+4, work_x, nx+4,      &
                        trig_xf, workx, 0 )
-          CALL ZDFFTM( 0, nx+1, nz1, sqr_dnx, work_x, nx+4, work_x, nx+4, &
+          CALL ZDFFTM( 0, nx+1, nz1, sqr_dnx, work_x, nx+4, work_x, nx+4,      &
                        trig_xb, workx, 0 )
 !
@@ -248,7 +278,7 @@
           CALL DZFFT( 0, ny+1, sqr_dny, work_y, work_y, trig_yf, worky, 0 )
           CALL ZDFFT( 0, ny+1, sqr_dny, work_y, work_y, trig_yb, worky, 0 )
-          CALL DZFFTM( 0, ny+1, nz1, sqr_dny, work_y, ny+4, work_y, ny+4, &
+          CALL DZFFTM( 0, ny+1, nz1, sqr_dny, work_y, ny+4, work_y, ny+4,      &
                        trig_yf, worky, 0 )
-          CALL ZDFFTM( 0, ny+1, nz1, sqr_dny, work_y, ny+4, work_y, ny+4, &
+          CALL ZDFFTM( 0, ny+1, nz1, sqr_dny, work_y, ny+4, work_y, ny+4,      &
                        trig_yb, worky, 0 )
 #elif defined( __cuda_fft )
@@ -278,5 +308,5 @@
           nx_c = nx+1
           ny_c = ny+1
-          ALLOCATE( x_in(0:nx+2), y_in(0:ny+2), x_out(0:(nx+1)/2), &
+          ALLOCATE( x_in(0:nx+2), y_in(0:ny+2), x_out(0:(nx+1)/2),             &
                     y_out(0:(ny+1)/2) )
           plan_xf = FFTW_PLAN_DFT_R2C_1D( nx_c, x_in, x_out, FFTW_ESTIMATE )
@@ -322,22 +352,33 @@
        IMPLICIT NONE
 
-       CHARACTER (LEN=*) ::  direction
-       INTEGER ::  i, ishape(1), j, k
-
-       LOGICAL ::  forward_fft
-
-       REAL, DIMENSION(0:nx+2)   ::  work
-       REAL, DIMENSION(nx+2)     ::  work1
-       COMPLEX, DIMENSION(:), ALLOCATABLE ::  cwork
+       CHARACTER (LEN=*) ::  direction  !:
+       
+       COMPLEX(wp), DIMENSION(:), ALLOCATABLE ::  cwork  !:
+
+       INTEGER(iwp) ::  i          !: 
+       INTEGER(iwp) ::  ishape(1)  !:
+       INTEGER(iwp) ::  j          !:
+       INTEGER(iwp) ::  k          !:
+
+       LOGICAL ::  forward_fft !:
+       
+       REAL(wp), DIMENSION(0:nx+2) ::  work   !:
+       REAL(wp), DIMENSION(nx+2)   ::  work1  !:
+       
 #if defined( __ibm )
-       REAL, DIMENSION(nau2)     ::  aux2, aux4
+       REAL(wp), DIMENSION(nau2) ::  aux2  !: 
+       REAL(wp), DIMENSION(nau2) ::  aux4  !:
 #elif defined( __nec )
-       REAL, DIMENSION(6*(nx+1)) ::  work2
+       REAL(wp), DIMENSION(6*(nx+1)) ::  work2  !:
 #elif defined( __cuda_fft )
-       COMPLEX(dpk), DIMENSION(0:(nx+1)/2,nys_x:nyn_x,nzb_x:nzt_x) ::  ar_tmp
+       COMPLEX(dpk), DIMENSION(0:(nx+1)/2,nys_x:nyn_x,nzb_x:nzt_x) ::          &
+          ar_tmp  !:
        !$acc declare create( ar_tmp )
 #endif
-       REAL, DIMENSION(0:nx,nys_x:nyn_x), OPTIONAL   ::  ar_2d
-       REAL, DIMENSION(0:nx,nys_x:nyn_x,nzb_x:nzt_x) ::  ar
+
+       REAL(wp), DIMENSION(0:nx,nys_x:nyn_x), OPTIONAL   ::                    &
+          ar_2d   !:
+       REAL(wp), DIMENSION(0:nx,nys_x:nyn_x,nzb_x:nzt_x) ::                    &
+          ar      !:
 
        IF ( direction == 'forward' )  THEN
@@ -540,6 +581,6 @@
                 DO  j = nys_x, nyn_x
 
-                   CALL DRCFT( 0, ar, 1, work, 1, nx+1, 1, 1, sqr_dnx, aux1, nau1, &
-                               aux2, nau2 )
+                   CALL DRCFT( 0, ar, 1, work, 1, nx+1, 1, 1, sqr_dnx, aux1,   &
+                               nau1, aux2, nau2 )
 
                    DO  i = 0, (nx+1)/2
@@ -570,6 +611,6 @@
                    work(nx+2) = 0.0
 
-                   CALL DCRFT( 0, work, 1, work, 1, nx+1, 1, -1, sqr_dnx, aux3, nau1, &
-                               aux4, nau2 )
+                   CALL DCRFT( 0, work, 1, work, 1, nx+1, 1, -1, sqr_dnx,      & 
+                               aux3, nau1, aux4, nau2 )
 
                    DO  i = 0, nx
@@ -709,17 +750,22 @@
        IMPLICIT NONE
 
-       CHARACTER (LEN=*) ::  direction
-       INTEGER ::  i, ishape(1)
-
-       LOGICAL ::  forward_fft
-
-       REAL, DIMENSION(0:nx)     ::  ar
-       REAL, DIMENSION(0:nx+2)   ::  work
-       REAL, DIMENSION(nx+2)     ::  work1
-       COMPLEX, DIMENSION(:), ALLOCATABLE ::  cwork
+       CHARACTER (LEN=*) ::  direction  !:
+       
+       INTEGER(iwp) ::  i               !:
+       INTEGER(iwp) ::  ishape(1)       !:
+
+       LOGICAL ::  forward_fft          !:
+
+       REAL(wp), DIMENSION(0:nx)   ::  ar     !:
+       REAL(wp), DIMENSION(0:nx+2) ::  work   !:
+       REAL(wp), DIMENSION(nx+2)   ::  work1  !:
+       
+       COMPLEX(wp), DIMENSION(:), ALLOCATABLE ::  cwork  !:
+       
 #if defined( __ibm )
-       REAL, DIMENSION(nau2)     ::  aux2, aux4
+       REAL(wp), DIMENSION(nau2) ::  aux2       !:
+       REAL(wp), DIMENSION(nau2) ::  aux4       !:
 #elif defined( __nec )
-       REAL, DIMENSION(6*(nx+1)) ::  work2
+       REAL(wp), DIMENSION(6*(nx+1)) ::  work2  !:
 #endif
 
@@ -838,5 +884,5 @@
           IF ( forward_fft )  THEN
 
-             CALL DRCFT( 0, ar, 1, work, 1, nx+1, 1, 1, sqr_dnx, aux1, nau1, &
+             CALL DRCFT( 0, ar, 1, work, 1, nx+1, 1, 1, sqr_dnx, aux1, nau1,   &
                          aux2, nau2 )
 
@@ -945,23 +991,37 @@
        IMPLICIT NONE
 
-       CHARACTER (LEN=*) ::  direction
-       INTEGER ::  i, j, jshape(1), k
-       INTEGER ::  nxl_y_bound, nxl_y_l, nxr_y_bound, nxr_y_l
-
-       LOGICAL ::  forward_fft
-
-       REAL, DIMENSION(0:ny+2)   ::  work
-       REAL, DIMENSION(ny+2)     ::  work1
-       COMPLEX, DIMENSION(:), ALLOCATABLE ::  cwork
+       CHARACTER (LEN=*) ::  direction  !:
+       
+       INTEGER(iwp) ::  i            !:
+       INTEGER(iwp) ::  j            !: 
+       INTEGER(iwp) ::  jshape(1)    !:
+       INTEGER(iwp) ::  k            !:
+       INTEGER(iwp) ::  nxl_y_bound  !:
+       INTEGER(iwp) ::  nxl_y_l      !:
+       INTEGER(iwp) ::  nxr_y_bound  !:
+       INTEGER(iwp) ::  nxr_y_l      !:
+
+       LOGICAL ::  forward_fft  !:
+
+       REAL(wp), DIMENSION(0:ny+2) ::  work   !:
+       REAL(wp), DIMENSION(ny+2)   ::  work1  !:
+       
+       COMPLEX(wp), DIMENSION(:), ALLOCATABLE ::  cwork  !:
+       
 #if defined( __ibm )
-       REAL, DIMENSION(nau2)     ::  auy2, auy4
+       REAL(wp), DIMENSION(nau2) ::  auy2  !:
+       REAL(wp), DIMENSION(nau2) ::  auy4  !:
 #elif defined( __nec )
-       REAL, DIMENSION(6*(ny+1)) ::  work2
+       REAL(wp), DIMENSION(6*(ny+1)) ::  work2  !:
 #elif defined( __cuda_fft )
-       COMPLEX(dpk), DIMENSION(0:(ny+1)/2,nxl_y:nxr_y,nzb_y:nzt_y) ::  ar_tmp
+       COMPLEX(dpk), DIMENSION(0:(ny+1)/2,nxl_y:nxr_y,nzb_y:nzt_y) ::          &
+          ar_tmp  !:
        !$acc declare create( ar_tmp )
 #endif
-       REAL, DIMENSION(0:ny,nxl_y_l:nxr_y_l,nzb_y:nzt_y) ::  ar
-       REAL, DIMENSION(0:ny,nxl_y_bound:nxr_y_bound,nzb_y:nzt_y) ::  ar_tr
+
+       REAL(wp), DIMENSION(0:ny,nxl_y_l:nxr_y_l,nzb_y:nzt_y)         ::        &
+          ar     !:
+       REAL(wp), DIMENSION(0:ny,nxl_y_bound:nxr_y_bound,nzb_y:nzt_y) ::        &
+          ar_tr  !:
 
        IF ( direction == 'forward' )  THEN
@@ -1140,6 +1200,6 @@
                 DO  i = nxl_y_l, nxr_y_l
 
-                   CALL DRCFT( 0, ar, 1, work, 1, ny+1, 1, 1, sqr_dny, auy1, nau1, &
-                               auy2, nau2 )
+                   CALL DRCFT( 0, ar, 1, work, 1, ny+1, 1, 1, sqr_dny, auy1,   & 
+                               nau1, auy2, nau2 )
 
                    DO  j = 0, (ny+1)/2
@@ -1170,6 +1230,6 @@
                    work(ny+2) = 0.0
 
-                   CALL DCRFT( 0, work, 1, work, 1, ny+1, 1, -1, sqr_dny, auy3, nau1, &
-                               auy4, nau2 )
+                   CALL DCRFT( 0, work, 1, work, 1, ny+1, 1, -1, sqr_dny,      &
+                               auy3, nau1, auy4, nau2 )
 
                    DO  j = 0, ny
@@ -1307,16 +1367,21 @@
 
        CHARACTER (LEN=*) ::  direction
-       INTEGER ::  j, jshape(1)
-
-       LOGICAL ::  forward_fft
-
-       REAL, DIMENSION(0:ny)     ::  ar
-       REAL, DIMENSION(0:ny+2)   ::  work
-       REAL, DIMENSION(ny+2)     ::  work1
-       COMPLEX, DIMENSION(:), ALLOCATABLE ::  cwork
+       
+       INTEGER(iwp) ::  j          !:
+       INTEGER(iwp) ::  jshape(1)  !:
+
+       LOGICAL ::  forward_fft  !:
+
+       REAL(wp), DIMENSION(0:ny)    ::  ar     !:
+       REAL(wp), DIMENSION(0:ny+2)  ::  work   !:
+       REAL(wp), DIMENSION(ny+2)    ::  work1  !:
+       
+       COMPLEX(wp), DIMENSION(:), ALLOCATABLE ::  cwork  !:
+       
 #if defined( __ibm )
-       REAL, DIMENSION(nau2)     ::  auy2, auy4
+       REAL(wp), DIMENSION(nau2) ::  auy2  !:
+       REAL(wp), DIMENSION(nau2) ::  auy4  !:
 #elif defined( __nec )
-       REAL, DIMENSION(6*(ny+1)) ::  work2
+       REAL(wp), DIMENSION(6*(ny+1)) ::  work2  !:
 #endif
 
@@ -1437,5 +1502,5 @@
           IF ( forward_fft )  THEN
 
-             CALL DRCFT( 0, ar, 1, work, 1, ny+1, 1, 1, sqr_dny, auy1, nau1, &
+             CALL DRCFT( 0, ar, 1, work, 1, ny+1, 1, 1, sqr_dny, auy1, nau1,   &
                          auy2, nau2 )
 
@@ -1458,6 +1523,6 @@
              work(ny+2) = 0.0
 
-             CALL DCRFT( 0, work, 1, work, 1, ny+1, 1, -1, sqr_dny, auy3, nau1, &
-                         auy4, nau2 )
+             CALL DCRFT( 0, work, 1, work, 1, ny+1, 1, -1, sqr_dny, auy3,      &
+                         nau1, auy4, nau2 )
 
              DO  j = 0, ny
@@ -1527,13 +1592,18 @@
        IMPLICIT NONE
 
-       CHARACTER (LEN=*)              ::  direction
-       INTEGER                        ::  i, k, siza
-
-       REAL, DIMENSION(0:nx,nz)       ::  ar
-       REAL, DIMENSION(0:nx+3,nz+1)   ::  ai
-       REAL, DIMENSION(6*(nx+4),nz+1) ::  work1
+       CHARACTER (LEN=*) ::  direction  !:
+       
+       INTEGER(iwp) ::  i     !:
+       INTEGER(iwp) ::  k     !:
+       INTEGER(iwp) ::  siza  !:
+
+       REAL(wp), DIMENSION(0:nx,nz)       ::  ar     !:
+       REAL(wp), DIMENSION(0:nx+3,nz+1)   ::  ai     !:
+       REAL(wp), DIMENSION(6*(nx+4),nz+1) ::  work1  !:
+       
 #if defined( __nec )
-       INTEGER                             ::  sizw
-       COMPLEX, DIMENSION((nx+4)/2+1,nz+1) ::  work
+       INTEGER(iwp) ::  sizw  !:
+       
+       COMPLEX(wp), DIMENSION((nx+4)/2+1,nz+1) ::  work  !:
 #endif
 
@@ -1588,5 +1658,5 @@
 !--          Tables are initialized once more. This call should not be
 !--          necessary, but otherwise program aborts in asymmetric case
-             CALL DZFFTM( 0, nx+1, nz1, sqr_dnx, work, nx+4, work, nx+4, &
+             CALL DZFFTM( 0, nx+1, nz1, sqr_dnx, work, nx+4, work, nx+4,       &
                           trig_xf, work1, 0 )
 
@@ -1596,5 +1666,5 @@
              ENDIF
 
-             CALL DZFFTM( 1, nx+1, nz1, sqr_dnx, ai, siza, work, sizw, &
+             CALL DZFFTM( 1, nx+1, nz1, sqr_dnx, ai, siza, work, sizw,         &
                           trig_xf, work1, 0 )
 
@@ -1613,5 +1683,5 @@
 !--          Tables are initialized once more. This call should not be
 !--          necessary, but otherwise program aborts in asymmetric case
-             CALL ZDFFTM( 0, nx+1, nz1, sqr_dnx, work, nx+4, work, nx+4, &
+             CALL ZDFFTM( 0, nx+1, nz1, sqr_dnx, work, nx+4, work, nx+4,       &
                           trig_xb, work1, 0 )
 
@@ -1664,13 +1734,19 @@
        IMPLICIT NONE
 
-       CHARACTER (LEN=*)              ::  direction
-       INTEGER                        ::  j, k, ny1, siza
-
-       REAL, DIMENSION(0:ny1,nz)      ::  ar
-       REAL, DIMENSION(0:ny+3,nz+1)   ::  ai
-       REAL, DIMENSION(6*(ny+4),nz+1) ::  work1
+       CHARACTER (LEN=*) ::  direction  !:
+       
+       INTEGER(iwp) ::  j     !: 
+       INTEGER(iwp) ::  k     !:
+       INTEGER(iwp) ::  ny1   !:
+       INTEGER(iwp) ::  siza  !:
+
+       REAL(wp), DIMENSION(0:ny1,nz)      ::  ar     !:
+       REAL(wp), DIMENSION(0:ny+3,nz+1)   ::  ai     !:
+       REAL(wp), DIMENSION(6*(ny+4),nz+1) ::  work1  !:
+       
 #if defined( __nec )
-       INTEGER                             ::  sizw
-       COMPLEX, DIMENSION((ny+4)/2+1,nz+1) ::  work
+       INTEGER(iwp) ::  sizw  !:
+       
+       COMPLEX(wp), DIMENSION((ny+4)/2+1,nz+1) ::  work !:
 #endif
 
Index: /palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/flow_statistics.f90	(revision 1319)
+++ /palm/trunk/SOURCE/flow_statistics.f90	(revision 1320)
@@ -21,12 +21,15 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
 ! -----------------
 ! $Id$
-!
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
 !
 ! 1299 2014-03-06 13:15:21Z heinze
@@ -66,98 +69,4 @@
 ! 801 2012-01-10 17:30:36Z suehring
 ! Calculation of turbulent fluxes in advec_ws is now thread-safe.
-!
-! 743 2011-08-18 16:10:16Z suehring
-! Calculation of turbulent fluxes with WS-scheme only for the whole model
-! domain, not for user-defined subregions. 
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 699 2011-03-22 17:52:22Z suehring
-! Bugfix in calculation of vertical velocity skewness. The added absolute value
-! avoid negative values in the root. Negative values of w'w' can occur at the
-! top or bottom of the model domain due to degrading the order of advection 
-! scheme. Furthermore the calculation will be the same for all advection
-! schemes.
-!, tend
-! 696 2011-03-18 07:03:49Z raasch
-! Bugfix: Summation of Wicker-Skamarock scheme fluxes and variances for all
-! threads
-!
-! 678 2011-02-02 14:31:56Z raasch
-! Bugfix in calculation of the divergence of vertical flux of resolved scale
-! energy, pressure fluctuations, and flux of pressure fluctuation itself
-!
-! 673 2011-01-18 16:19:48Z suehring
-! Top bc for the horizontal velocity variances added for ocean runs.
-! Setting the corresponding bottom bc moved to advec_ws.
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! When advection is computed with ws-scheme, turbulent fluxes are already
-! computed in the respective advection routines and buffered in arrays
-! sums_xx_ws_l(). This is due to a consistent treatment of statistics with the
-! numerics and to avoid unphysical kinks near the surface. 
-! So some if requests has to be done to dicern between fluxes from ws-scheme
-! other advection schemes. 
-! Furthermore the computation of z_i is only done if the heat flux exceeds a
-! minimum value. This affects only simulations of a neutral boundary layer and
-! is due to reasons of computations in the advection scheme.
-!
-! 624 2010-12-10 11:46:30Z heinze
-! Calculation of q*2 added
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 388 2009-09-23 09:40:33Z raasch
-! Vertical profiles of potential density and hydrostatic pressure are
-! calculated.
-! Added missing timeseries calculation of w"q"(0), moved timeseries q* to the
-! end.
-! Temperature gradient criterion for estimating the boundary layer height
-! replaced by the gradient criterion of Sullivan et al. (1998).
-! Output of messages replaced by message handling routine.
-!
-! 197 2008-09-16 15:29:03Z raasch
-! Spline timeseries splptx etc. removed, timeseries w'u', w'v', w'q' (k=0)
-! added,
-! bugfix: divide sums(k,8) (e) and sums(k,34) (e*) by ngp_2dh_s_inner(k,sr) 
-! (like other scalars)
-!
-! 133 2007-11-20 10:10:53Z letzel
-! Vertical profiles now based on nzb_s_inner; they are divided by 
-! ngp_2dh_s_inner (scalars, procucts of scalars) and ngp_2dh (staggered 
-! velocity components and their products, procucts of scalars and velocity 
-! components), respectively.
-!
-! 106 2007-08-16 14:30:26Z raasch
-! Prescribed momentum fluxes at the top surface are used,
-! profiles for w*p* and w"e are calculated
-!
-! 97 2007-06-21 08:23:15Z raasch
-! Statistics for ocean version (salinity, density) added,
-! calculation of z_i and Deardorff velocity scale adjusted to be used with
-! the ocean version
-!
-! 87 2007-05-22 15:46:47Z raasch
-! Two more arguments added to user_statistics, which is now also called for
-! user-defined profiles,
-! var_hom and var_sum renamed pr_palm
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Cpp-directive lcmuk changed to intel_openmp_bug
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Collection of time series quantities moved from routine flow_statistics to
-! here, routine user_statistics is called for each statistic region,
-! moisture renamed humidity
-!
-! 19 2007-02-23 04:53:48Z raasch
-! fluxes at top modified (tswst, qswst)
-! 
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.41  2006/08/04 14:37:50  raasch
-! Error removed in non-parallel part (sums_l)
 !
 ! Revision 1.1  1997/08/11 06:15:17  raasch
@@ -177,21 +86,61 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY :  ddzu, ddzw, e, hyp, km, kh,nr,  p, prho, pt, q, qc, ql, qr,    &
+                qs, qsws, qswst, rho, sa, saswsb, saswst, shf, ts, tswst, u,   &
+                ug, us, usws, uswst, vsws, v, vg, vpt, vswst, w, w_subs, zw
+        
+    USE cloud_parameters,                                                      &
+        ONLY :  l_d_cp, prr, pt_d_t
+        
+    USE control_parameters,                                                    &
+        ONLY :  average_count_pr, cloud_droplets, cloud_physics, do_sum,       &
+                dt_3d, g, humidity, icloud_scheme, kappa, max_pr_user,         &
+                message_string, ocean, passive_scalar, precipitation,          &
+                use_surface_fluxes, use_top_fluxes, ws_scheme_mom, ws_scheme_sca
+        
+    USE cpulog,                                                                &
+        ONLY :  cpu_log, log_point
+        
+    USE grid_variables,                                                        &
+        ONLY :  ddx, ddy
+        
+    USE indices,                                                               &
+        ONLY :  ngp_2dh, ngp_2dh_s_inner, ngp_3d, ngp_3d_inner, ngp_sums, nxl, &
+                nxr, nyn, nys, nzb, nzb_diff_s_inner, nzb_s_inner, nzt, nzt_diff
+        
+    USE kinds
+    
     USE pegrid
+    
     USE statistics
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, omp_get_thread_num, sr, tn
-    LOGICAL ::  first
-    REAL    ::  dptdz_threshold, height, pts, sums_l_eper, sums_l_etot, ust, &
-                ust2, u2, vst, vst2, v2, w2, z_i(2)
-    REAL    ::  dptdz(nzb+1:nzt+1)
-    REAL    ::  sums_ll(nzb:nzt+1,2)
+    INTEGER(iwp) ::  i                   !:
+    INTEGER(iwp) ::  j                   !:
+    INTEGER(iwp) ::  k                   !:
+    INTEGER(iwp) ::  omp_get_thread_num  !:
+    INTEGER(iwp) ::  sr                  !:
+    INTEGER(iwp) ::  tn                  !:
+    
+    LOGICAL ::  first  !:
+    
+    REAL(wp) ::  dptdz_threshold  !: 
+    REAL(wp) ::  height           !:
+    REAL(wp) ::  pts              !:
+    REAL(wp) ::  sums_l_eper      !:
+    REAL(wp) ::  sums_l_etot      !:
+    REAL(wp) ::  ust              !:
+    REAL(wp) ::  ust2             !:
+    REAL(wp) ::  u2               !:
+    REAL(wp) ::  vst              !:
+    REAL(wp) ::  vst2             !:
+    REAL(wp) ::  v2               !:
+    REAL(wp) ::  w2               !:
+    REAL(wp) ::  z_i(2)           !:
+    
+    REAL(wp) ::  dptdz(nzb+1:nzt+1)    !:
+    REAL(wp) ::  sums_ll(nzb:nzt+1,2)  !:
 
     CALL cpu_log( log_point(10), 'flow_statistics', 'start' )
@@ -248,11 +197,11 @@
              sums_l(:,31,i) = sums_vs2_ws_l(:,i)        ! v*2 
              sums_l(:,32,i) = sums_ws2_ws_l(:,i)        ! w*2 
-             sums_l(:,34,i) = sums_l(:,34,i) + 0.5 *                        & 
-                              ( sums_us2_ws_l(:,i) + sums_vs2_ws_l(:,i) +   &
+             sums_l(:,34,i) = sums_l(:,34,i) + 0.5 *                           & 
+                              ( sums_us2_ws_l(:,i) + sums_vs2_ws_l(:,i) +      &
                                 sums_ws2_ws_l(:,i) )    ! e*
              DO  k = nzb, nzt
-                sums_l(nzb+5,pr_palm,i) = sums_l(nzb+5,pr_palm,i) + 0.5 * ( &
-                                                      sums_us2_ws_l(k,i) +  &
-                                                      sums_vs2_ws_l(k,i) +  &
+                sums_l(nzb+5,pr_palm,i) = sums_l(nzb+5,pr_palm,i) + 0.5 * (    &
+                                                      sums_us2_ws_l(k,i) +     &
+                                                      sums_vs2_ws_l(k,i) +     &
                                                       sums_ws2_ws_l(k,i) )
              ENDDO
@@ -382,30 +331,30 @@
 !--    Compute total sum from local sums
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( sums_l(nzb,1,0), sums(nzb,1), nzt+2-nzb, MPI_REAL, &
+       CALL MPI_ALLREDUCE( sums_l(nzb,1,0), sums(nzb,1), nzt+2-nzb, MPI_REAL,  &
                            MPI_SUM, comm2d, ierr )
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( sums_l(nzb,2,0), sums(nzb,2), nzt+2-nzb, MPI_REAL, &
+       CALL MPI_ALLREDUCE( sums_l(nzb,2,0), sums(nzb,2), nzt+2-nzb, MPI_REAL,  &
                            MPI_SUM, comm2d, ierr )
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-       CALL MPI_ALLREDUCE( sums_l(nzb,4,0), sums(nzb,4), nzt+2-nzb, MPI_REAL, &
+       CALL MPI_ALLREDUCE( sums_l(nzb,4,0), sums(nzb,4), nzt+2-nzb, MPI_REAL,  &
                            MPI_SUM, comm2d, ierr )
        IF ( ocean )  THEN
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,23,0), sums(nzb,23), nzt+2-nzb, &
+          CALL MPI_ALLREDUCE( sums_l(nzb,23,0), sums(nzb,23), nzt+2-nzb,       &
                               MPI_REAL, MPI_SUM, comm2d, ierr )
        ENDIF
        IF ( humidity ) THEN
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,44,0), sums(nzb,44), nzt+2-nzb, &
+          CALL MPI_ALLREDUCE( sums_l(nzb,44,0), sums(nzb,44), nzt+2-nzb,       &
                               MPI_REAL, MPI_SUM, comm2d, ierr )
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb, &
+          CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb,       &
                               MPI_REAL, MPI_SUM, comm2d, ierr )
           IF ( cloud_physics ) THEN
              IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-             CALL MPI_ALLREDUCE( sums_l(nzb,42,0), sums(nzb,42), nzt+2-nzb, &
+             CALL MPI_ALLREDUCE( sums_l(nzb,42,0), sums(nzb,42), nzt+2-nzb,    &
                                  MPI_REAL, MPI_SUM, comm2d, ierr )
              IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-             CALL MPI_ALLREDUCE( sums_l(nzb,43,0), sums(nzb,43), nzt+2-nzb, &
+             CALL MPI_ALLREDUCE( sums_l(nzb,43,0), sums(nzb,43), nzt+2-nzb,    &
                                  MPI_REAL, MPI_SUM, comm2d, ierr )
           ENDIF
@@ -414,5 +363,5 @@
        IF ( passive_scalar )  THEN
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb, &
+          CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb,       &
                               MPI_REAL, MPI_SUM, comm2d, ierr )
        ENDIF
@@ -468,5 +417,5 @@
 !
 !--    Passive scalar
-       IF ( passive_scalar )  hom(:,1,41,sr) = sums(:,41) /  &
+       IF ( passive_scalar )  hom(:,1,41,sr) = sums(:,41) /                    &
             ngp_2dh_s_inner(:,sr)                    ! s (q)
 
@@ -527,14 +476,14 @@
 !
 !--          2D-arrays (being collected in the last column of sums_l)
-             sums_l(nzb,pr_palm,tn)   = sums_l(nzb,pr_palm,tn) +   &
+             sums_l(nzb,pr_palm,tn)   = sums_l(nzb,pr_palm,tn) +               &
                                         us(j,i)   * rmask(j,i,sr)
-             sums_l(nzb+1,pr_palm,tn) = sums_l(nzb+1,pr_palm,tn) + &
+             sums_l(nzb+1,pr_palm,tn) = sums_l(nzb+1,pr_palm,tn) +             &
                                         usws(j,i) * rmask(j,i,sr)
-             sums_l(nzb+2,pr_palm,tn) = sums_l(nzb+2,pr_palm,tn) + &
+             sums_l(nzb+2,pr_palm,tn) = sums_l(nzb+2,pr_palm,tn) +             &
                                         vsws(j,i) * rmask(j,i,sr)
-             sums_l(nzb+3,pr_palm,tn) = sums_l(nzb+3,pr_palm,tn) + &
+             sums_l(nzb+3,pr_palm,tn) = sums_l(nzb+3,pr_palm,tn) +             &
                                         ts(j,i)   * rmask(j,i,sr)
              IF ( humidity )  THEN
-                sums_l(nzb+12,pr_palm,tn) = sums_l(nzb+12,pr_palm,tn) + &
+                sums_l(nzb+12,pr_palm,tn) = sums_l(nzb+12,pr_palm,tn) +        &
                                             qs(j,i)   * rmask(j,i,sr)
              ENDIF
@@ -1349,22 +1298,68 @@
  SUBROUTINE flow_statistics
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  ddzu, ddzw, e, hyp, km, kh,nr,  p, prho, pt, q, qc, ql, qr,     &
+               qs, qsws, qswst, rho, sa, saswsb, saswst, shf, ts, tswst, u,    &
+               ug, us, usws, uswst, vsws, v, vg, vpt, vswst, w, w_subs, zw
+        
+    USE cloud_parameters,                                                      &
+        ONLY:  l_d_cp, prr, pt_d_t
+        
+    USE control_parameters,                                                    &
+        ONLY:  average_count_pr, cloud_droplets, cloud_physics, do_sum,        &
+               dt_3d, g, humidity, icloud_scheme, kappa, max_pr_user,          &
+               message_string, ocean, passive_scalar, precipitation,           &
+               use_surface_fluxes, use_top_fluxes, ws_scheme_mom, ws_scheme_sca
+        
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+        
+    USE grid_variables,                                                        &
+        ONLY:  ddx, ddy
+        
+    USE indices,                                                               &
+        ONLY:  ngp_2dh, ngp_2dh_s_inner, ngp_3d, ngp_3d_inner, ngp_sums, nxl,  &
+               nxr, nyn, nys, nzb, nzb_diff_s_inner, nzb_s_inner, nzt, nzt_diff
+        
+    USE kinds
+    
     USE pegrid
+    
     USE statistics
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, omp_get_thread_num, sr, tn
-    LOGICAL ::  first
-    REAL    ::  dptdz_threshold, height, pts, sums_l_eper, sums_l_etot, ust, &
-                ust2, u2, vst, vst2, v2, w2, z_i(2)
-    REAL    ::  s1, s2, s3, s4, s5, s6, s7
-    REAL    ::  dptdz(nzb+1:nzt+1)
-    REAL    ::  sums_ll(nzb:nzt+1,2)
+    INTEGER(iwp) ::  i                   !:
+    INTEGER(iwp) ::  j                   !:
+    INTEGER(iwp) ::  k                   !:
+    INTEGER(iwp) ::  omp_get_thread_num  !:
+    INTEGER(iwp) ::  sr                  !:
+    INTEGER(iwp) ::  tn                  !:
+    
+    LOGICAL ::  first  !:
+    
+    REAL(wp) ::  dptdz_threshold  !:
+    REAL(wp) ::  height           !:
+    REAL(wp) ::  pts              !:
+    REAL(wp) ::  sums_l_eper      !:
+    REAL(wp) ::  sums_l_etot      !:
+    REAL(wp) ::  s1               !:
+    REAL(wp) ::  s2               !:
+    REAL(wp) ::  s3               !:
+    REAL(wp) ::  s4               !:
+    REAL(wp) ::  s5               !:
+    REAL(wp) ::  s6               !:
+    REAL(wp) ::  s7               !:
+    REAL(wp) ::  ust              !:
+    REAL(wp) ::  ust2             !:
+    REAL(wp) ::  u2,              !:
+    REAL(wp) ::  vst              !:
+    REAL(wp) ::  vst2             !:
+    REAL(wp) ::  v2               !:
+    REAL(wp) ::  w2               !:
+    REAL(wp) ::  z_i(2)           !:
+
+    REAL(wp) ::  dptdz(nzb+1:nzt+1)    !:
+    REAL(wp) ::  sums_ll(nzb:nzt+1,2)  !:
 
     CALL cpu_log( log_point(10), 'flow_statistics', 'start' )
Index: /palm/trunk/SOURCE/global_min_max.f90
===================================================================
--- /palm/trunk/SOURCE/global_min_max.f90	(revision 1319)
+++ /palm/trunk/SOURCE/global_min_max.f90	(revision 1320)
@@ -21,5 +21,11 @@
 ! Current revisions:
 ! ------------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -35,17 +41,4 @@
 ! 866 2012-03-28 06:44:41Z raasch
 ! new mode "absoff" accounts for an offset in the respective array
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Adapting of the index arrays, because MINLOC assumes lowerbound at 1 and not 
-! at nbgp.
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! Feb. 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.11  2003/04/16 12:56:58  raasch
-! Index values of the extrema are limited to the range 0..nx, 0..ny
 !
 ! Revision 1.1  1997/07/24 11:14:03  raasch
@@ -58,25 +51,52 @@
 !------------------------------------------------------------------------------!
 
-    USE indices
+    USE indices,                                                               &
+        ONLY:  nbgp, ny, nx
+        
+    USE kinds
+    
     USE pegrid
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  mode
-
-    INTEGER           ::  i, i1, i2, id_fmax, id_fmin, j, j1, j2, k, k1, k2, &
-                          fmax_ijk(3), fmax_ijk_l(3), fmin_ijk(3), &
-                          fmin_ijk_l(3), value_ijk(3)
-    INTEGER, OPTIONAL ::  value1_ijk(3)
-    REAL              ::  offset, value, &
-                          ar(i1:i2,j1:j2,k1:k2)
+    CHARACTER (LEN=*) ::  mode  !:
+
+    INTEGER(iwp) ::  i              !:
+    INTEGER(iwp) ::  i1             !:
+    INTEGER(iwp) ::  i2             !:
+    INTEGER(iwp) ::  id_fmax        !:
+    INTEGER(iwp) ::  id_fmin        !:
+    INTEGER(iwp) ::  j              !:
+    INTEGER(iwp) ::  j1             !:
+    INTEGER(iwp) ::  j2             !:
+    INTEGER(iwp) ::  k              !:
+    INTEGER(iwp) ::  k1             !:
+    INTEGER(iwp) ::  k2             !:
+    INTEGER(iwp) ::  fmax_ijk(3)    !:
+    INTEGER(iwp) ::  fmax_ijk_l(3)  !:
+    INTEGER(iwp) ::  fmin_ijk(3)    !:
+    INTEGER(iwp) ::  fmin_ijk_l(3)  !:
+    INTEGER(iwp) ::  value_ijk(3)   !:
+    
+    INTEGER(iwp), OPTIONAL ::  value1_ijk(3)  !:
+    
+    REAL(wp) ::  offset                 !:
+    REAL(wp) ::  value                  !:
+    REAL(wp) ::  ar(i1:i2,j1:j2,k1:k2)  !:
+    
 #if defined( __ibm )
-    REAL (KIND=4)     ::  fmax(2), fmax_l(2), fmin(2), fmin_l(2)  ! on 32bit-
-                          ! machines MPI_2REAL must not be replaced by
-                          ! MPI_2DOUBLE_PRECISION
-#else
-    REAL              ::  fmax(2), fmax_l(2), fmin(2), fmin_l(2)
-#endif
-    REAL, OPTIONAL    ::  value1
+    REAL(sp) ::  fmax(2)    !:
+    REAL(sp) ::  fmax_l(2)  !:
+    REAL(sp) ::  fmin(2)    !:
+    REAL(sp) ::  fmin_l(2)  !:
+             ! on 32bit-machines MPI_2REAL must not be replaced 
+             ! by MPI_2DOUBLE_PRECISION
+#else
+    REAL(wp) ::  fmax(2)    !:
+    REAL(wp) ::  fmax_l(2)  !:
+    REAL(wp) ::  fmin(2)    !:
+    REAL(wp) ::  fmin_l(2)  !:
+#endif
+    REAL(wp), OPTIONAL ::  value1  !:
 
 
Index: /palm/trunk/SOURCE/header.f90
===================================================================
--- /palm/trunk/SOURCE/header.f90	(revision 1319)
+++ /palm/trunk/SOURCE/header.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -108,91 +114,4 @@
 ! 825 2012-02-19 03:03:44Z raasch
 ! Output of cloud physics parameters/quantities complemented and restructured
-!
-! 767 2011-10-14 06:39:12Z raasch
-! Output of given initial u,v-profiles
-!
-! 759 2011-09-15 13:58:31Z raasch
-! output of maximum number of parallel io streams
-!
-! 707 2011-03-29 11:39:40Z raasch
-! bc_lr/ns replaced by bc_lr/ns_cyc
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Output of advection scheme.
-! Modified output of Prandtl-layer height.
-!
-! 580 2010-10-05 13:59:11Z heinze
-! Renaming of ws_vertical_gradient to subs_vertical_gradient,
-! ws_vertical_gradient_level to subs_vertical_gradient_level and
-! ws_vertical_gradient_level_ind to subs_vertical_gradient_level_i
-!
-! 493 2010-03-01 08:30:24Z raasch
-! NetCDF data output format extendend for NetCDF4/HDF5
-!
-! 449 2010-02-02 11:23:59Z raasch
-! +large scale vertical motion (subsidence/ascent)
-! Bugfix: index problem concerning gradient_level indices removed
-!
-! 410 2009-12-04 17:05:40Z letzel
-! Masked data output: + dt_domask, mask_01~20_x|y|z, mask_01~20_x|y|z_loop, 
-! mask_scale|_x|y|z, masks, skip_time_domask
-!
-! 346 2009-07-06 10:13:41Z raasch
-! initializing_actions='read_data_for_recycling' renamed to 'cyclic_fill'
-! Coupling with independent precursor runs.
-! Output of messages replaced by message handling routine.
-! Output of several additional dvr parameters
-! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left,
-! canyon_wall_south, conserve_volume_flow_mode, dp_external, dp_level_b, 
-! dp_smooth, dpdxy, u_bulk, v_bulk
-! topography_grid_convention moved from user_header
-! small bugfix concerning 3d 64bit netcdf output format
-!
-! 206 2008-10-13 14:59:11Z raasch
-! Bugfix: error in zu index in case of section_xy = -1
-!
-! 198 2008-09-17 08:55:28Z raasch
-! Format adjustments allowing output of larger revision numbers
-!
-! 197 2008-09-16 15:29:03Z raasch
-! allow 100 spectra levels instead of 10 for consistency with 
-! define_netcdf_header,
-! bugfix in the output of the characteristic levels of potential temperature, 
-! geostrophic wind, scalar concentration, humidity and leaf area density,
-! output of turbulence recycling informations
-!
-! 138 2007-11-28 10:03:58Z letzel
-! Allow new case bc_uv_t = 'dirichlet_0' for channel flow.
-! Allow two instead of one digit to specify isosurface and slicer variables.
-! Output of sorting frequency of particles
-!
-! 108 2007-08-24 15:10:38Z letzel
-! Output of informations for coupled model runs (boundary conditions etc.)
-! + output of momentumfluxes at the top boundary
-! Rayleigh damping for ocean, e_init
-!
-! 97 2007-06-21 08:23:15Z raasch
-! Adjustments for the ocean version.
-! use_pt_reference renamed use_reference
-!
-! 87 2007-05-22 15:46:47Z raasch
-! Bugfix: output of use_upstream_for_tke
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Preprocessor strings for different linux clusters changed to "lc",
-! routine local_flush is used for buffer flushing
-!
-! 76 2007-03-29 00:58:32Z raasch
-! Output of netcdf_64bit_3d, particles-package is now part of the default code,
-! output of the loop optimization method, moisture renamed humidity,
-! output of subversion revision number
-!
-! 19 2007-02-23 04:53:48Z raasch
-! Output of scalar flux applied at top boundary
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.63  2006/08/22 13:53:13  raasch
-! Output of dz_max
 !
 ! Revision 1.1  1997/08/11 06:17:20  raasch
@@ -209,38 +128,111 @@
 !-----------------------------------------------------------------------------!
 
-    USE arrays_3d
+    USE arrays_3d,                                                             &
+        ONLY:  lad, pt_init, qsws, q_init, sa_init, shf, ug, vg, w_subs, zu
+        
     USE control_parameters
-    USE cloud_parameters
-    USE cpulog
-    USE dvrp_variables
-    USE grid_variables
-    USE indices
-    USE model_1d
-    USE particle_attributes
+        
+    USE cloud_parameters,                                                      &
+        ONLY:  cp, curvature_solution_effects, c_sedimentation,                &
+               limiter_sedimentation, l_v, nc_const, r_d, ventilation_effect
+        
+    USE cpulog,                                                                &
+        ONLY:  log_point_s
+        
+    USE dvrp_variables,                                                        &
+        ONLY:  use_seperate_pe_for_dvrp_output
+        
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+        
+    USE indices,                                                               &
+        ONLY:  mg_loc_ind, nnx, nny, nnz, nx, ny, nxl_mg, nxr_mg, nyn_mg,      &
+               nys_mg, nzt, nzt_mg
+        
+    USE kinds
+    
+    USE model_1d,                                                              &
+        ONLY:  damp_level_ind_1d, dt_pr_1d, dt_run_control_1d, end_time_1d
+        
+    USE particle_attributes,                                                   &
+        ONLY:  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, collision_kernel,     &
+               density_ratio, dissipation_classes, dt_min_part, dt_prel,       &
+               dt_sort_particles, dt_write_particle_data, end_time_prel,       &
+               maximum_number_of_tailpoints, maximum_tailpoint_age,            &
+               minimum_tailpoint_distance, number_of_particle_groups,          &
+               particle_advection, particle_advection_start,                   &
+               particles_per_point, pdx, pdy, pdz,  psb, psl, psn, psr, pss,   &
+               pst, radius, radius_classes, random_start_position,             &
+               total_number_of_particles, use_particle_tails,                  &
+               use_sgs_for_particles, total_number_of_tails,                   &
+               vertical_particle_advection, write_particle_statistics
+        
     USE pegrid
-    USE subsidence_mod
-    USE spectrum
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=1)  ::  prec
-    CHARACTER (LEN=2)  ::  do2d_mode
-    CHARACTER (LEN=5)  ::  section_chr
-    CHARACTER (LEN=10) ::  coor_chr, host_chr
-    CHARACTER (LEN=16) ::  begin_chr
-    CHARACTER (LEN=26) ::  ver_rev
-    CHARACTER (LEN=40) ::  output_format
-    CHARACTER (LEN=70) ::  char1, char2, dopr_chr, &
-                           do2d_xy, do2d_xz, do2d_yz, do3d_chr, &
-                           domask_chr, run_classification
-    CHARACTER (LEN=86) ::  coordinates, gradients, learde, slices,  &
-                           temperatures, ugcomponent, vgcomponent
-    CHARACTER (LEN=85) ::  roben, runten
-
-    CHARACTER (LEN=1), DIMENSION(1:3) ::  dir = (/ 'x', 'y', 'z' /)
-
-    INTEGER ::  av, bh, blx, bly, bxl, bxr, byn, bys, ch, count, cwx, cwy,  &
-                cxl, cxr, cyn, cys, dim, i, io, j, l, ll, mpi_type
-    REAL    ::  cpuseconds_per_simulated_second
+    CHARACTER (LEN=1)  ::  prec                !:
+    
+    CHARACTER (LEN=2)  ::  do2d_mode           !:
+    
+    CHARACTER (LEN=5)  ::  section_chr         !:
+    
+    CHARACTER (LEN=10) ::  coor_chr            !:
+    CHARACTER (LEN=10) ::  host_chr            !:
+    
+    CHARACTER (LEN=16) ::  begin_chr           !:
+    
+    CHARACTER (LEN=26) ::  ver_rev             !:
+    
+    CHARACTER (LEN=40) ::  output_format       !:
+    
+    CHARACTER (LEN=70) ::  char1               !:
+    CHARACTER (LEN=70) ::  char2               !:
+    CHARACTER (LEN=70) ::  dopr_chr            !:
+    CHARACTER (LEN=70) ::  do2d_xy             !:
+    CHARACTER (LEN=70) ::  do2d_xz             !:
+    CHARACTER (LEN=70) ::  do2d_yz             !:
+    CHARACTER (LEN=70) ::  do3d_chr            !:
+    CHARACTER (LEN=70) ::  domask_chr          !:
+    CHARACTER (LEN=70) ::  run_classification  !:
+    
+    CHARACTER (LEN=85) ::  roben               !:
+    CHARACTER (LEN=85) ::  runten              !:
+    
+    CHARACTER (LEN=86) ::  coordinates         !:
+    CHARACTER (LEN=86) ::  gradients           !:
+    CHARACTER (LEN=86) ::  learde              !:
+    CHARACTER (LEN=86) ::  slices              !:
+    CHARACTER (LEN=86) ::  temperatures        !:
+    CHARACTER (LEN=86) ::  ugcomponent         !:
+    CHARACTER (LEN=86) ::  vgcomponent         !:
+
+    CHARACTER (LEN=1), DIMENSION(1:3) ::  dir = (/ 'x', 'y', 'z' /)  !:
+
+    INTEGER(iwp) ::  av        !:
+    INTEGER(iwp) ::  bh        !:
+    INTEGER(iwp) ::  blx       !:
+    INTEGER(iwp) ::  bly       !:
+    INTEGER(iwp) ::  bxl       !:
+    INTEGER(iwp) ::  bxr       !:
+    INTEGER(iwp) ::  byn       !:
+    INTEGER(iwp) ::  bys       !:
+    INTEGER(iwp) ::  ch        !:
+    INTEGER(iwp) ::  count     !:
+    INTEGER(iwp) ::  cwx       !:
+    INTEGER(iwp) ::  cwy       !:
+    INTEGER(iwp) ::  cxl       !:
+    INTEGER(iwp) ::  cxr       !:
+    INTEGER(iwp) ::  cyn       !:
+    INTEGER(iwp) ::  cys       !:
+    INTEGER(iwp) ::  dim       !:
+    INTEGER(iwp) ::  i         !:
+    INTEGER(iwp) ::  io        !:
+    INTEGER(iwp) ::  j         !:
+    INTEGER(iwp) ::  l         !:
+    INTEGER(iwp) ::  ll        !:
+    INTEGER(iwp) ::  mpi_type  !:
+    
+    REAL(wp) ::  cpuseconds_per_simulated_second  !:
 
 !
Index: /palm/trunk/SOURCE/impact_of_latent_heat.f90
===================================================================
--- /palm/trunk/SOURCE/impact_of_latent_heat.f90	(revision 1319)
+++ /palm/trunk/SOURCE/impact_of_latent_heat.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -28,15 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 72 2007-03-19 08:20:46Z
-! precipitation_rate renamed dqdt_precip
-!
-! 19 2007-02-23 04:53:48Z raasch
-! Calculation extended for gridpoint nzt
-! 
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.5  2004/01/30 10:25:59  raasch
-! Scalar lower k index nzb replaced by 2d-array nzb_2d
 !
 ! Revision 1.1  2000/04/13 14:48:40  schroeter
@@ -66,13 +61,22 @@
     SUBROUTINE impact_of_latent_heat
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE constants
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ql, tend
+           
+       USE cloud_parameters,                                                   &
+           ONLY:  l_d_cp, prec_time_const, pt_d_t, ql_crit
+           
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb_2d, nzt
+           
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  dqdt_precip
+       INTEGER(iwp) ::  i  !:
+       INTEGER(iwp) ::  j  !:
+       INTEGER(iwp) ::  k  !:
+       
+       REAL(wp) ::  dqdt_precip  !:
 
  
@@ -100,13 +104,22 @@
     SUBROUTINE impact_of_latent_heat_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE constants
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ql, tend
+           
+       USE cloud_parameters,                                                   &
+           ONLY:  l_d_cp, prec_time_const, pt_d_t, ql_crit
+           
+       USE indices,                                                            &
+           ONLY:  nzb_2d, nzt
+           
+       USE kinds                                                               
    
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  dqdt_precip
+       INTEGER(iwp) ::  i  !:
+       INTEGER(iwp) ::  j  !:
+       INTEGER(iwp) ::  k  !:
+       
+       REAL(wp) ::  dqdt_precip  !:
 
 
Index: /palm/trunk/SOURCE/inflow_turbulence.f90
===================================================================
--- /palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1319)
+++ /palm/trunk/SOURCE/inflow_turbulence.f90	(revision 1320)
@@ -20,5 +20,13 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
+!
+! module interfaces removed
 !
 ! Former revisions:
@@ -26,7 +34,4 @@
 ! $Id$
 !
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
-!
 ! 1092 2013-02-02 11:24:22Z raasch
 ! unused variables removed
@@ -34,17 +39,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Using nbgp recycling planes for a better resolution of the turbulent flow 
-! near the inflow.
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 222 2009-01-12 16:04:16Z letzel
-! Bugfix for nonparallel execution
 !
 ! Initial version (2008/03/07)
@@ -56,9 +48,21 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  e, inflow_damping_factor, mean_inflow_profiles, pt, u, v, w
+        
+    USE control_parameters,                                                    &
+        ONLY:  recycling_plane
+        
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+        
+    USE grid_variables,                                                        &
+        ONLY:  
+        
+    USE indices,                                                               &
+        ONLY:  nbgp, nxl, ny, nyn, nys, nyng, nysg, nzb, nzt
+        
+    USE kinds
+    
     USE pegrid
 
@@ -66,8 +70,15 @@
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, ngp_ifd, ngp_pr
-
-    REAL, DIMENSION(nzb:nzt+1,5,nbgp) ::  avpr, avpr_l
-    REAL, DIMENSION(nzb:nzt+1,nysg:nyng,5,nbgp) ::  inflow_dist
+    INTEGER(iwp) ::  i        !:
+    INTEGER(iwp) ::  j        !:
+    INTEGER(iwp) ::  k        !:
+    INTEGER(iwp) ::  l        !:
+    INTEGER(iwp) ::  ngp_ifd  !:
+    INTEGER(iwp) ::  ngp_pr   !:
+
+    REAL(wp), DIMENSION(nzb:nzt+1,5,nbgp)           ::                         &
+       avpr, avpr_l  !:
+    REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,5,nbgp) ::                         &
+       inflow_dist   !:
 
     CALL cpu_log( log_point(40), 'inflow_turbulence', 'start' )
Index: /palm/trunk/SOURCE/init_1d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_1d_model.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_1d_model.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -41,31 +47,4 @@
 ! 978 2012-08-09 08:28:32Z fricke
 ! roughness length for scalar quantities z0h1d added
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! replaced mirror boundary conditions for u and v  at the ground
-! by dirichlet boundary conditions
-!
-! 254 2009-03-05 15:33:42Z heinze
-! Output of messages replaced by message handling routine.
-!
-! 184 2008-08-04 15:53:39Z letzel
-! provisional solution for run_control_1d output: add 'CALL check_open( 15 )'
-!
-! 135 2007-11-22 12:24:23Z raasch
-! Bugfix: absolute value of f must be used when calculating the Blackadar
-! mixing length
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Preprocessor strings for different linux clusters changed to "lc",
-! routine local_flush is used for buffer flushing
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Bugfix: preset of tendencies te_em, te_um, te_vm,
-! moisture renamed humidity
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.21  2006/06/02 15:19:57  raasch
-! cpp-directives extended for lctit
 !
 ! Revision 1.1  1998/03/09 16:22:10  raasch
@@ -81,24 +60,40 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE indices
-    USE model_1d
-    USE control_parameters
+    USE arrays_3d,                                                             &
+        ONLY:  l_grid, ug, u_init, vg, v_init, zu
+    
+    USE indices,                                                               &
+        ONLY:  nzb, nzt
+    
+    USE kinds
+    
+    USE model_1d,                                                              &
+        ONLY:  e1d, e1d_p, kh1d, km1d, l1d, l_black, qs1d, rif1d,              &
+               simulated_time_1d, te_e, te_em, te_u, te_um, te_v, te_vm, ts1d, &
+               u1d, u1d_p, us1d, usws1d, v1d, v1d_p, vsws1d, z01d, z0h1d
+    
+    USE control_parameters,                                                    &
+        ONLY:  constant_diffusion, f, humidity, kappa, km_constant,            &
+               mixing_length_1d, passive_scalar, prandtl_layer,                &
+               prandtl_number, roughness_length, simulated_time_chr,           &
+               z0h_factor
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=9) ::  time_to_string
-    INTEGER ::  k
-    REAL    ::  lambda
+    CHARACTER (LEN=9) ::  time_to_string  !:
+    
+    INTEGER(iwp) ::  k  !: 
+    
+    REAL(wp) ::  lambda !:
 
 !
 !-- Allocate required 1D-arrays
-    ALLOCATE( e1d(nzb:nzt+1),    e1d_p(nzb:nzt+1), &
-              kh1d(nzb:nzt+1),   km1d(nzb:nzt+1),  &
-              l_black(nzb:nzt+1), l1d(nzb:nzt+1),   &
-              rif1d(nzb:nzt+1),   te_e(nzb:nzt+1),  &
-              te_em(nzb:nzt+1),  te_u(nzb:nzt+1),    te_um(nzb:nzt+1), &
-              te_v(nzb:nzt+1),   te_vm(nzb:nzt+1),    u1d(nzb:nzt+1),   &
-              u1d_p(nzb:nzt+1),  v1d(nzb:nzt+1),   &
+    ALLOCATE( e1d(nzb:nzt+1),    e1d_p(nzb:nzt+1),                             &
+              kh1d(nzb:nzt+1),   km1d(nzb:nzt+1),                              &
+              l_black(nzb:nzt+1), l1d(nzb:nzt+1),                              &
+              rif1d(nzb:nzt+1),   te_e(nzb:nzt+1),                             &
+              te_em(nzb:nzt+1),  te_u(nzb:nzt+1),    te_um(nzb:nzt+1),         &
+              te_v(nzb:nzt+1),   te_vm(nzb:nzt+1),    u1d(nzb:nzt+1),          &
+              u1d_p(nzb:nzt+1),  v1d(nzb:nzt+1),                               &
               v1d_p(nzb:nzt+1) )
 
@@ -120,5 +115,5 @@
 !--       Blackadar mixing length
           IF ( f /= 0.0 )  THEN
-             lambda = 2.7E-4 * SQRT( ug(nzt+1)**2 + vg(nzt+1)**2 ) / &
+             lambda = 2.7E-4 * SQRT( ug(nzt+1)**2 + vg(nzt+1)**2 ) /           &
                                ABS( f ) + 1E-10
           ELSE
@@ -197,16 +192,45 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE indices
-    USE model_1d
+    USE arrays_3d,                                                             &
+        ONLY:  dd2zu, ddzu, ddzw, l_grid, pt_init, q_init, ug, vg, zu
+        
+    USE control_parameters,                                                    &
+        ONLY:  constant_diffusion, dissipation_1d, humidity,                   &
+               intermediate_timestep_count, intermediate_timestep_count_max,   &
+               f, g, ibc_e_b, kappa, mixing_length_1d, passive_scalar,         &
+               prandtl_layer, rif_max, rif_min, simulated_time_chr,            &
+               timestep_scheme, tsc
+                
+    USE indices,                                                               &
+        ONLY:  nzb, nzb_diff, nzt
+        
+    USE kinds
+    
+    USE model_1d,                                                              &
+        ONLY:  current_timestep_number_1d, damp_level_ind_1d, dt_1d,           &
+               dt_pr_1d, dt_run_control_1d, e1d, e1d_p, end_time_1d,           &
+               kh1d, km1d, l1d, l_black, qs1d, rif1d, simulated_time_1d,       &
+               stop_dt_1d, te_e, te_em, te_u, te_um, te_v, te_vm, time_pr_1d,  &
+               ts1d, time_run_control_1d, u1d, u1d_p, us1d, usws1d, v1d,       &
+               v1d_p, vsws1d, z01d, z0h1d
+        
     USE pegrid
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=9) ::  time_to_string
-    INTEGER ::  k
-    REAL    ::  a, b, dissipation, dpt_dz, flux, kmzm, kmzp, l_stable, pt_0, &
-                uv_total
+    CHARACTER (LEN=9) ::  time_to_string  !:
+    
+    INTEGER(iwp) ::  k  !:
+    
+    REAL(wp) ::  a            !:
+    REAL(wp) ::  b            !:
+    REAL(wp) ::  dissipation  !:
+    REAL(wp) ::  dpt_dz       !:
+    REAL(wp) ::  flux         !:
+    REAL(wp) ::  kmzm         !:
+    REAL(wp) ::  kmzp         !:
+    REAL(wp) ::  l_stable     !:
+    REAL(wp) ::  pt_0         !:
+    REAL(wp) ::  uv_total     !:
 
 !
@@ -704,14 +728,30 @@
 !------------------------------------------------------------------------------!
 
-    USE constants
-    USE indices
-    USE model_1d
+    USE constants,                                                             &
+        ONLY:  pi
+        
+    USE indices,                                                               &
+        ONLY:  nzb, nzt
+        
+    USE kinds
+    
+    USE model_1d,                                                              &
+        ONLY:  current_timestep_number_1d, dt_1d, run_control_header_1d, u1d,  &
+               us1d, v1d
+    
     USE pegrid
-    USE control_parameters
+    
+    USE control_parameters,                                                    &
+        ONLY:  simulated_time_chr
 
     IMPLICIT NONE
 
-    INTEGER ::  k
-    REAL    ::  alpha, energy, umax, uv_total, vmax
+    INTEGER(iwp) ::  k  !:
+    
+    REAL(wp) ::  alpha 
+    REAL(wp) ::  energy 
+    REAL(wp) ::  umax
+    REAL(wp) ::  uv_total 
+    REAL(wp) ::  vmax
 
 !
@@ -775,14 +815,28 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE indices
-    USE model_1d
+    USE arrays_3d,                                                             &
+        ONLY:  dzu, zu
+        
+    USE indices,                                                               &
+        ONLY:  nzb, nzt
+    
+    USE kinds
+    
+    USE model_1d,                                                              &
+        ONLY:  dt_1d, dt_max_1d, km1d, old_dt_1d, stop_dt_1d
+    
     USE pegrid
-    USE control_parameters
+    
+    USE control_parameters,                                                              &
+        ONLY:  message_string
 
     IMPLICIT NONE
 
-    INTEGER ::  k
-    REAL    ::  div, dt_diff, fac, value
+    INTEGER(iwp) ::  k !:
+    
+    REAL(wp) ::  div      !:
+    REAL(wp) ::  dt_diff  !:
+    REAL(wp) ::  fac      !:
+    REAL(wp) ::  value    !:
 
 
@@ -834,14 +888,24 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE indices
-    USE model_1d
+    USE arrays_3d,                                                             &
+        ONLY:  pt_init, zu
+        
+    USE indices,                                                               &
+        ONLY:  nzb, nzt
+        
+    USE kinds
+    
+    USE model_1d,                                                              &
+        ONLY:  e1d, kh1d, km1d, l1d, rif1d, u1d, v1d
+    
     USE pegrid
-    USE control_parameters
+    
+    USE control_parameters,                                                    &
+        ONLY:  run_description_header, simulated_time_chr
 
     IMPLICIT NONE
 
 
-    INTEGER ::  k
+    INTEGER(iwp) ::  k  !:
 
 
Index: /palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_3d_model.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_3d_model.f90	(revision 1320)
@@ -20,12 +20,17 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
+!
+! module interfaces removed
 !
 ! Former revisions:
 ! -----------------
 ! $Id$
-!
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
 !
 ! 1316 2014-03-17 07:44:59Z heinze
@@ -122,128 +127,4 @@
 ! 825 2012-02-19 03:03:44Z raasch
 ! wang_collision_kernel renamed wang_kernel
-!
-! 790 2011-11-29 03:11:20Z raasch
-! diss is also allocated in case that the Wang kernel is used
-!
-! 787 2011-11-28 12:49:05Z heinze $
-! bugfix: call init_advec in every case - not only for inital runs
-!
-! 785 2011-11-28 09:47:19Z raasch
-! initialization of rdf_sc
-!
-! 767 2011-10-14 06:39:12Z raasch
-! adjustments concerning implementation of prescribed u,v-profiles
-! bugfix: dirichlet_0 conditions for ug/vg moved to check_parameters
-!
-! 759 2011-09-15 13:58:31Z raasch
-! Splitting of parallel I/O in blocks of PEs
-! Bugfix: No zero assignments to volume_flow_initial and volume_flow_area in
-! case of normal restart runs.
-!
-! 713 2011-03-30 14:21:21Z suehring
-! weight_substep and weight_pres are given as fractions.
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 707 2011-03-29 11:39:40Z raasch
-! p_sub renamed p_loc and allocated depending on the chosen pressure solver,
-! initial assignments of zero to array p for iterative solvers only,
-! bc_lr/ns replaced by bc_lr/ns_dirrad/raddir
-!
-! 680 2011-02-04 23:16:06Z gryschka
-! bugfix: volume_flow_control
-!
-! 673 2011-01-18 16:19:48Z suehring 
-! weight_substep (moved from advec_ws) and weight_pres added.
-! Allocate p_sub when using Multigrid or SOR solver.
-! Call of ws_init moved behind the if requests.
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng in loops and 
-! allocation of arrays. Calls of exchange_horiz are modified.
-! Call ws_init to initialize arrays needed for calculating statisticas and for
-! optimization when ws-scheme is used.
-! Initial volume flow is now calculated by using the variable hom_sum.
-! Therefore the correction of initial volume flow for non-flat topography
-! removed (removed u_nzb_p1_for_vfc and v_nzb_p1_for_vfc) 
-! Changed surface boundary conditions for u and v in case of ibc_uv_b == 0 from
-! mirror to Dirichlet boundary conditions (u=v=0), so that k=nzb is 
-! representative for the height z0.
-! Bugfix: type conversion of '1' to 64bit for the MAX function (ngp_3d_inner) 
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 560 2010-09-09 10:06:09Z weinreis
-! bugfix: correction of calculating ngp_3d for 64 bit
-!
-! 485 2010-02-05 10:57:51Z raasch
-! calculation of ngp_3d + ngp_3d_inner changed because they have now 64 bit
-!
-! 407 2009-12-01 15:01:15Z maronga
-! var_ts is replaced by dots_max 
-! Enabled passive scalar/humidity wall fluxes for non-flat topography
-!
-! 388 2009-09-23 09:40:33Z raasch
-! Initialization of prho added.
-! bugfix: correction of initial volume flow for non-flat topography
-! bugfix: zero initialization of arrays within buildings for 'cyclic_fill'
-! bugfix: avoid that ngp_2dh_s_inner becomes zero
-! initializing_actions='read_data_for_recycling' renamed to 'cyclic_fill', now
-! independent of turbulent_inflow
-! Output of messages replaced by message handling routine.
-! Set the starting level and the vertical smoothing factor used for 
-! the external pressure gradient
-! +conserve_volume_flow_mode: 'default', 'initial_profiles', 'inflow_profile'
-! and 'bulk_velocity'
-! If the inversion height calculated by the prerun is zero,
-! inflow_damping_height must be explicitly specified.
-!
-! 181 2008-07-30 07:07:47Z raasch
-! bugfix: zero assignments to tendency arrays in case of restarts,
-! further extensions and modifications in the initialisation of the plant 
-! canopy model,
-! allocation of hom_sum moved to parin, initialization of spectrum_x|y directly
-! after allocating theses arrays,
-! read data for recycling added as new initialization option,
-! dummy allocation for diss
-!
-! 138 2007-11-28 10:03:58Z letzel
-! New counter ngp_2dh_s_inner.
-! Allow new case bc_uv_t = 'dirichlet_0' for channel flow.
-! Corrected calculation of initial volume flow for 'set_1d-model_profiles' and
-! 'set_constant_profiles' in case of buildings in the reference cross-sections.
-!
-! 108 2007-08-24 15:10:38Z letzel
-! Flux initialization in case of coupled runs, +momentum fluxes at top boundary,
-! +arrays for phase speed c_u, c_v, c_w, indices for u|v|w_m_l|r changed
-! +qswst_remote in case of atmosphere model with humidity coupled to ocean
-! Rayleigh damping for ocean, optionally calculate km and kh from initial
-! TKE e_init
-!
-! 97 2007-06-21 08:23:15Z raasch
-! Initialization of salinity, call of init_ocean
-!
-! 87 2007-05-22 15:46:47Z raasch
-! var_hom and var_sum renamed pr_palm
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Arrays for radiation boundary conditions are allocated (u_m_l, u_m_r, etc.),
-! bugfix for cases with the outflow damping layer extending over more than one
-! subdomain, moisture renamed humidity,
-! new initializing action "by_user" calls user_init_3d_model,
-! precipitation_amount/rate, ts_value are allocated, +module netcdf_control,
-! initial velocities at nzb+1 are regarded for volume
-! flow control in case they have been set zero before (to avoid small timesteps)
-! -uvmean_outflow, uxrp, vynp eliminated
-!
-! 19 2007-02-23 04:53:48Z raasch
-! +handling of top fluxes
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.49  2006/08/22 15:59:07  raasch
-! No optimization of this file on the ibmy (Yonsei Univ.)
 !
 ! Revision 1.1  1998/03/09 16:22:22  raasch
@@ -262,34 +143,62 @@
 
     USE advec_ws
+
     USE arrays_3d
-    USE averaging
-    USE cloud_parameters
-    USE constants
+    
+    USE cloud_parameters,                                                      &
+        ONLY:  nc_const, precipitation_amount, precipitation_rate, prr
+    
+    USE constants,                                                             &
+        ONLY:  pi
+    
     USE control_parameters
-    USE cpulog
-    USE grid_variables
+    
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+    
     USE indices
+    
+    USE kinds
+    
     USE ls_forcing_mod
-    USE model_1d
+    
+    USE model_1d,                                                              &
+        ONLY:  e1d, kh1d, km1d, l1d, rif1d, u1d, us1d, usws1d, v1d, vsws1d 
+    
     USE netcdf_control
-    USE particle_attributes
+    
+    USE particle_attributes,                                                   &
+        ONLY:  particle_advection, use_sgs_for_particles, wang_kernel
+    
     USE pegrid
-    USE profil_parameter
-    USE random_function_mod
-    USE statistics
-    USE transpose_indices
+    
+    USE random_function_mod 
+    
+    USE statistics,                                                            &
+        ONLY:  hom, hom_sum, pr_palm, rmask, spectrum_x, spectrum_y,           &
+               statistic_regions, sums, sums_divnew_l, sums_divold_l, sums_l,  &
+               sums_l_l, sums_up_fraction_l, sums_wsts_bc_l, ts_value,         &
+               weight_pres, weight_substep 
+    
+    USE transpose_indices 
 
     IMPLICIT NONE
 
-    INTEGER ::  i, ind_array(1), j, k, sr
-
-    INTEGER, DIMENSION(:), ALLOCATABLE ::  ngp_2dh_l
-
-    INTEGER, DIMENSION(:,:), ALLOCATABLE ::  ngp_2dh_outer_l,  &
-                                             ngp_2dh_s_inner_l
-
-    REAL, DIMENSION(1:2) ::  volume_flow_area_l, volume_flow_initial_l
-
-    REAL, DIMENSION(:), ALLOCATABLE ::  ngp_3d_inner_l, ngp_3d_inner_tmp
+    INTEGER(iwp) ::  i             !:
+    INTEGER(iwp) ::  ind_array(1)  !:
+    INTEGER(iwp) ::  j             !:
+    INTEGER(iwp) ::  k             !:
+    INTEGER(iwp) ::  sr            !:
+
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE   ::  ngp_2dh_l  !:
+
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  ngp_2dh_outer_l    !:
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  ngp_2dh_s_inner_l  !:
+
+    REAL(wp), DIMENSION(1:2) ::  volume_flow_area_l     !:
+    REAL(wp), DIMENSION(1:2) ::  volume_flow_initial_l  !:
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  ngp_3d_inner_l    !:
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  ngp_3d_inner_tmp  !:
 
 
Index: /palm/trunk/SOURCE/init_advec.f90
===================================================================
--- /palm/trunk/SOURCE/init_advec.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_advec.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -35,9 +41,4 @@
 ! all actions concerning upstream-spline-method removed
 !
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.6  2004/04/30 11:59:31  raasch
-! impulse_advec renamed momentum_advec
-!
 ! Revision 1.1  1999/02/05 09:07:38  raasch
 ! Initial revision
@@ -49,13 +50,28 @@
 !------------------------------------------------------------------------------!
 
-    USE advection
-    USE arrays_3d
-    USE indices
-    USE control_parameters
+    USE advection,                                                             &
+        ONLY:  aex, bex, dex, eex
+        
+    USE kinds
+    
+    USE control_parameters,                                                    &
+        ONLY:  scalar_advec
 
     IMPLICIT NONE
 
-    INTEGER :: i, intervals, j
-    REAL    :: delt, dn, dnneu, ex1, ex2, ex3, ex4, ex5, ex6, sterm
+    INTEGER(iwp) ::  i          !:
+    INTEGER(iwp) ::  intervals  !: 
+    INTEGER(iwp) ::  j          !:
+    
+    REAL(wp) :: delt   !:
+    REAL(wp) :: dn     !:
+    REAL(wp) :: dnneu  !:
+    REAL(wp) :: ex1    !:
+    REAL(wp) :: ex2    !:
+    REAL(wp) :: ex3    !:
+    REAL(wp) :: ex4    !:
+    REAL(wp) :: ex5    !:
+    REAL(wp) :: ex6    !:
+    REAL(wp) :: sterm  !:
 
 
Index: /palm/trunk/SOURCE/init_cloud_physics.f90
===================================================================
--- /palm/trunk/SOURCE/init_cloud_physics.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_cloud_physics.f90	(revision 1320)
@@ -20,4 +20,11 @@
 ! Current revisions:
 ! -----------------
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module mod_kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -41,17 +48,4 @@
 ! calculation of b_cond replaced by calculation of bfactor
 !
-! 221 2009-01-12 15:32:23Z raasch
-! Bugfix: abort in case that absolute temperature is below zero
-!
-! 95 2007-06-02 16:48:38Z raasch
-! hydro_press renamed hyp
-!
-! February 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.5  2005/06/26 19:55:58  raasch
-! Initialization of cloud droplet constants, gas_constant renamed r_d,
-! latent_heat renamed l_v
-!
 ! Revision 1.1  2000/04/13 14:37:22  schroeter
 ! Initial revision
@@ -63,15 +57,31 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE constants
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  dzu, hyp, pt_init, zu
+        
+    USE cloud_parameters,                                                      &
+        ONLY:  bfactor, cp, c_sedimentation, dpirho_l, dt_precipitation,       &
+               hyrho, l_d_cp, l_d_r, l_d_rv, l_v, mass_of_solute,              &
+               molecular_weight_of_solute, molecular_weight_of_water, pirho_l, &
+               pt_d_t, rho_l, r_d, r_v, schmidt, schmidt_p_1d3, t_d_pt,        &
+               vanthoff, w_precipitation
+        
+    USE constants,                                                             &
+        ONLY:  pi
+        
+    USE control_parameters,                                                    &
+        ONLY:  g, icloud_scheme, message_string, precipitation, pt_surface,    &
+               rho_surface, surface_pressure
+    
+    USE indices,                                                               &
+        ONLY:  nzb, nzt
+    
+    USE kinds
 
     IMPLICIT NONE
 
-    INTEGER ::  k
-    REAL    ::  t_surface
+    INTEGER(iwp) ::  k      !:
+    
+    REAL(wp) ::  t_surface  !:
 
     ALLOCATE( hyp(nzb:nzt+1), pt_d_t(nzb:nzt+1), t_d_pt(nzb:nzt+1),  &
Index: /palm/trunk/SOURCE/init_coupling.f90
===================================================================
--- /palm/trunk/SOURCE/init_coupling.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_coupling.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -28,17 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 691 2011-03-04 08:45:30Z maronga
-! Bugfix: combine_plot_fields did not work with data_output_2d_on_each_pe = .T.
-! for precursor ocean runs
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! determination of target_id's moved to init_pegrid
-!
-! 291 2009-04-16 12:07:26Z raasch
-! Coupling with independent precursor runs.
 !
 ! 222 2009-01-12 16:04:16Z letzel
@@ -51,7 +44,10 @@
 !------------------------------------------------------------------------------!
 
+    USE control_parameters,                                                    &
+        ONLY:  coupling_char, coupling_mode
+        
+    USE kinds
+    
     USE pegrid
-    USE control_parameters
-    USE indices
 
     IMPLICIT NONE
@@ -59,6 +55,8 @@
 !
 !-- Local variables
-    INTEGER               ::  i, inter_color
-    INTEGER, DIMENSION(:) ::  bc_data(0:3) = 0
+    INTEGER(iwp) ::  i            !:
+    INTEGER(iwp) ::  inter_color  !:
+    
+    INTEGER(iwp), DIMENSION(:) ::  bc_data(0:3) = 0  !:
 
 !
Index: /palm/trunk/SOURCE/init_dvrp.f90
===================================================================
--- /palm/trunk/SOURCE/init_dvrp.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_dvrp.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -28,38 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 284 2009-04-06 06:36:10Z raasch
-! Definition of a colortable to be used for particles.
-! Output names are changed: surface=groundplate, buildings=topography
-! Output of messages replaced by message handling routine.
-! Clipping implemented.
-! Polygon reduction for building and ground plate isosurface. Reduction level
-! for buildings can be chosen with parameter cluster_size.
-! Steering, splitting, and rtsp routines not used on nec.
-! ToDo: checking of mode_dvrp for legal values is not correct
-! Implementation of a MPI-1 coupling: __mpi2 adjustments for MPI_COMM_WORLD
-!
-! 210 2008-11-06 08:54:02Z raasch
-! DVRP arguments changed to single precision, mode pathlines added
-!
-! 155 2008-03-28 10:56:30Z letzel
-! introduce prefix_chr to ensure unique dvrp_file path
-!
-! 130 2007-11-13 14:08:40Z letzel
-! allow two instead of one digit to specify isosurface and slicer variables
-! Test output of isosurface on camera file
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Preprocessor strings for different linux clusters changed to "lc",
-! routine local_flush is used for buffer flushing
-!
-! 17 2007-02-19 01:57:39Z raasch
-! dvrp_output_local activated for all streams
-!
-! 13 2007-02-14 12:15:07Z raasch
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.12  2006/02/23 12:30:22  raasch
-! ebene renamed section, pl.. replaced by do..,
 !
 ! Revision 1.1  2000/04/27 06:24:39  raasch
@@ -73,30 +45,82 @@
 #if defined( __dvrp_graphics )
 
-    USE arrays_3d
+    USE arrays_3d,                                                             &
+        ONLY:  zu
+        
     USE DVRP
+    
     USE dvrp_variables
-    USE grid_variables
-    USE indices
+    
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+        
+    USE indices,                                                               &
+        ONLY:  nx, nxl, nxr, ny, nyn, nys, nzb, nzb_s_inner
+        
+    USE kinds
+    
     USE pegrid
-    USE control_parameters
+    
+    USE control_parameters,                                                               &
+        ONLY:  message_string, nz_do3d, run_identifier, topography
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=2)  ::  section_chr
-    CHARACTER (LEN=3)  ::  prefix_chr
-    CHARACTER (LEN=80) ::  dvrp_file_local
-    INTEGER ::  cluster_mode, cluster_size_x, cluster_size_y, cluster_size_z, &
-                gradient_normals, i, j, k, l, m, nx_dvrp_l, nx_dvrp_r,        &
-                ny_dvrp_n, ny_dvrp_s, pn, tv, vn
-    LOGICAL ::  allocated
-    REAL(4) ::  center(3), cluster_alpha, distance, tmp_b, tmp_g, tmp_r, &
-                tmp_t, tmp_th, tmp_thr, tmp_x1, tmp_x2, tmp_y1, tmp_y2,  &
-                tmp_z1, tmp_z2, tmp_1, tmp_2, tmp_3, tmp_4, tmp_5, tmp_6, tmp_7
-
-    REAL(4), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf
-
-    TYPE(CSTRING), SAVE ::  dvrp_directory_c, dvrp_file_c, &
-                            dvrp_file_local_c,dvrp_host_c, &
-                            dvrp_password_c, dvrp_username_c, name_c
+    CHARACTER (LEN=2)  ::  section_chr      !:
+    CHARACTER (LEN=3)  ::  prefix_chr       !:
+    CHARACTER (LEN=80) ::  dvrp_file_local  !:
+    
+    INTEGER(iwp) ::  cluster_mode      !:
+    INTEGER(iwp) ::  cluster_size_x    !:
+    INTEGER(iwp) ::  cluster_size_y    !:
+    INTEGER(iwp) ::  cluster_size_z    !:
+    INTEGER(iwp) ::  gradient_normals  !:
+    INTEGER(iwp) ::  i                 !:
+    INTEGER(iwp) ::  j                 !:
+    INTEGER(iwp) ::  k                 !:
+    INTEGER(iwp) ::  l                 !:
+    INTEGER(iwp) ::  m                 !:
+    INTEGER(iwp) ::  nx_dvrp_l         !:
+    INTEGER(iwp) ::  nx_dvrp_r         !:
+    INTEGER(iwp) ::  ny_dvrp_n         !:
+    INTEGER(iwp) ::  ny_dvrp_s         !:
+    INTEGER(iwp) ::  pn                !:
+    INTEGER(iwp) ::  tv                !:
+    INTEGER(iwp) ::  vn                !:
+                     
+    LOGICAL  ::  allocated  !:
+    
+    REAL(sp) ::  center(3)      !:
+    REAL(sp) ::  cluster_alpha  !:
+    REAL(sp) ::  distance       !:
+    REAL(sp) ::  tmp_b          !:
+    REAL(sp) ::  tmp_g          !:
+    REAL(sp) ::  tmp_r          !:
+    REAL(sp) ::  tmp_t          !:
+    REAL(sp) ::  tmp_th         !:
+    REAL(sp) ::  tmp_thr        !:
+    REAL(sp) ::  tmp_x1         !:
+    REAL(sp) ::  tmp_x2         !:
+    REAL(sp) ::  tmp_y1         !:
+    REAL(sp) ::  tmp_y2         !:
+    REAL(sp) ::  tmp_z1         !:
+    REAL(sp) ::  tmp_z2         !:
+    REAL(sp) ::  tmp_1          !:
+    REAL(sp) ::  tmp_2          !:
+    REAL(sp) ::  tmp_3          !:
+    REAL(sp) ::  tmp_4          !:
+    REAL(sp) ::  tmp_5          !:
+    REAL(sp) ::  tmp_6          !:
+    REAL(sp) ::  tmp_7          !:
+
+    REAL(sp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf  !:
+
+    TYPE(CSTRING), SAVE ::  dvrp_directory_c   !:
+    TYPE(CSTRING), SAVE ::  dvrp_file_c        !:
+    TYPE(CSTRING), SAVE ::  dvrp_file_local_c  !:
+    TYPE(CSTRING), SAVE ::  dvrp_host_c        !:
+    TYPE(CSTRING), SAVE ::  dvrp_password_c    !:
+    TYPE(CSTRING), SAVE ::  dvrp_username_c    !:
+    TYPE(CSTRING), SAVE ::  name_c             !:
 
 !
@@ -718,12 +742,16 @@
 #if defined( __dvrp_graphics )
 
-    USE control_parameters
-    USE dvrp_variables
+    USE dvrp_variables,                                                        &
+        ONLY:  use_seperate_pe_for_dvrp_output
+    
+    USE kinds
+    
     USE pegrid
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=4) ::  chr
-    INTEGER           ::  idummy
+    CHARACTER (LEN=4) ::  chr  !:
+    
+    INTEGER(iwp) ::  idummy    !:
 
 !
@@ -778,10 +806,13 @@
 !------------------------------------------------------------------------------!
 #if defined( __dvrp_graphics )
-
-    USE control_parameters
-    USE dvrp
-    USE dvrp_variables
-
-    INTEGER ::  m
+                                               
+    USE DVRP
+    
+    USE dvrp_variables,                                                        &
+        ONLY: use_seperate_pe_for_dvrp_output
+    
+    USE kinds
+
+    INTEGER(iwp) ::  m  !:
 
 !
Index: /palm/trunk/SOURCE/init_grid.f90
===================================================================
--- /palm/trunk/SOURCE/init_grid.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_grid.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -81,59 +87,4 @@
 ! New cpp directive "__check" implemented which is used by check_namelist_files
 !
-! 759 2011-09-15 13:58:31Z raasch
-! Splitting of parallel I/O in blocks of PEs
-!
-! 722 2011-04-11 06:21:09Z raasch
-! Bugfix: bc_lr/ns_cyc replaced by bc_lr/ns, because variables are not yet set
-!         here
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 707 2011-03-29 11:39:40Z raasch
-! bc_lr/ns replaced by bc_lr/ns_cyc
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Definition of new array bounds nxlg, nxrg, nysg, nyng on each PE. 
-! Furthermore the allocation of arrays and steering of loops is done with these
-! parameters. Call of exchange_horiz are modified.
-! In case of dirichlet bounday condition at the bottom zu(0)=0.0
-! dzu_mg has to be set explicitly for a equally spaced grid near bottom.
-! ddzu_pres added to use a equally spaced grid near bottom.
-!
-! 555 2010-09-07 07:32:53Z raasch
-! Bugfix: default setting of nzb_local for flat topography
-!
-! 274 2009-03-26 15:11:21Z heinze
-! Output of messages replaced by message handling routine.
-! new topography case 'single_street_canyon'
-!
-! 217 2008-12-09 18:00:48Z letzel
-! +topography_grid_convention
-!
-! 134 2007-11-21 07:28:38Z letzel
-! Redefine initial nzb_local as the actual total size of topography (later the 
-! extent of topography in nzb_local is reduced by 1dx at the E topography walls 
-! and by 1dy at the N topography walls to form the basis for nzb_s_inner); 
-! for consistency redefine 'single_building' case.
-! Calculation of wall flag arrays
-!
-! 94 2007-06-01 15:25:22Z raasch
-! Grid definition for ocean version
-!
-! 75 2007-03-22 09:54:05Z raasch
-! storage of topography height arrays zu_s_inner and zw_s_inner,
-! 2nd+3rd argument removed from exchange horiz
-!
-! 19 2007-02-23 04:53:48Z raasch
-! Setting of nzt_diff
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.17  2006/08/22 14:00:05  raasch
-! +dz_max to limit vertical stretching,
-! bugfix in index array initialization for line- or point-like topography
-! structures
-!
 ! Revision 1.1  1997/08/11 06:17:45  raasch
 ! Initial revision (Testversion)
@@ -145,27 +96,93 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  dd2zu, ddzu, ddzu_pres, ddzw, dzu, dzu_mg, dzw, dzw_mg, f1_mg,  &
+               f2_mg, f3_mg, l_grid, l_wall, zu, zw
+        
+    USE control_parameters,                                                             &
+        ONLY:  bc_lr, bc_ns, building_height, building_length_x,               &
+               building_length_y, building_wall_left, building_wall_south,     &
+               canyon_height, canyon_wall_left, canyon_wall_south,             &
+               canyon_width_x, canyon_width_y, coupling_char, dp_level_ind_b,  &
+               dz, dz_max, dz_stretch_factor, dz_stretch_level,                &
+               dz_stretch_level_index, ibc_uv_b, io_blocks, io_group,          &
+               inflow_l, inflow_n, inflow_r, inflow_s, masking_method,         &
+               maximum_grid_level, message_string, momentum_advec, ocean,      &
+               outflow_l, outflow_n, outflow_r, outflow_s, prandtl_layer,      &
+               psolver, scalar_advec, topography, topography_grid_convention,  &
+               use_surface_fluxes, use_top_fluxes, wall_adjustment_factor 
+        
+    USE grid_variables,                                                        &
+        ONLY:  ddx, ddx2, ddx2_mg, ddy, ddy2, ddy2_mg, dx, dx2, dy, dy2, fwxm, &
+               fwxp, fwym, fwyp, fxm, fxp, fym, fyp, wall_e_x, wall_e_y,       &
+               wall_u, wall_v, wall_w_x, wall_w_y, zu_s_inner, zw_w_inner
+        
+    USE indices,                                                               &
+        ONLY:  flags, nbgp, nx, nxl, nxlg, nxlu, nxl_mg, nxr, nxrg, nxr_mg,    &
+               ny, nyn, nyng, nyn_mg, nys, nysv, nys_mg, nysg, nz, nzb,        &
+               nzb_2d, nzb_diff, nzb_diff_s_inner, nzb_diff_s_outer,           &
+               nzb_diff_u, nzb_diff_v, nzb_max, nzb_s_inner, nzb_s_outer,      &
+               nzb_u_inner, nzb_u_outer, nzb_v_inner, nzb_v_outer,             &
+               nzb_w_inner, nzb_w_outer, nzt, nzt_diff, nzt_mg, rflags_invers, &
+               rflags_s_inner, wall_flags_0, wall_flags_00, wall_flags_1,      &
+               wall_flags_10, wall_flags_2, wall_flags_3,  wall_flags_4,       &
+               wall_flags_5, wall_flags_6, wall_flags_7, wall_flags_8,         &
+               wall_flags_9
+    
+    USE kinds
+    
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER ::  bh, blx, bly, bxl, bxr, byn, bys, ch, cwx, cwy, cxl, cxr, cyn, &
-                cys, gls, i, ii, inc, j, k, l, nxl_l, nxr_l, nyn_l, nys_l,     &
-                nzb_si, nzt_l, vi
-
-    INTEGER, DIMENSION(:), ALLOCATABLE   ::  vertical_influence
-
-    INTEGER, DIMENSION(:,:), ALLOCATABLE ::  corner_nl, corner_nr, corner_sl,  &
-                                             corner_sr, wall_l, wall_n, wall_r,&
-                                             wall_s, nzb_local, nzb_tmp
-
-    LOGICAL :: flag_set = .FALSE.
-
-    REAL    ::  dx_l, dy_l, dz_stretched
-
-    REAL, DIMENSION(:,:), ALLOCATABLE   ::  topo_height
+    INTEGER(iwp) ::  bh      !:
+    INTEGER(iwp) ::  blx     !:
+    INTEGER(iwp) ::  bly     !:
+    INTEGER(iwp) ::  bxl     !:
+    INTEGER(iwp) ::  bxr     !:
+    INTEGER(iwp) ::  byn     !:
+    INTEGER(iwp) ::  bys     !:
+    INTEGER(iwp) ::  ch      !:
+    INTEGER(iwp) ::  cwx     !:
+    INTEGER(iwp) ::  cwy     !:
+    INTEGER(iwp) ::  cxl     !:
+    INTEGER(iwp) ::  cxr     !:
+    INTEGER(iwp) ::  cyn     !:
+    INTEGER(iwp) ::  cys     !:
+    INTEGER(iwp) ::  gls     !:
+    INTEGER(iwp) ::  i       !:
+    INTEGER(iwp) ::  ii      !:
+    INTEGER(iwp) ::  inc     !:
+    INTEGER(iwp) ::  j       !:
+    INTEGER(iwp) ::  k       !:
+    INTEGER(iwp) ::  l       !:
+    INTEGER(iwp) ::  nxl_l   !:
+    INTEGER(iwp) ::  nxr_l   !:
+    INTEGER(iwp) ::  nyn_l   !:
+    INTEGER(iwp) ::  nys_l   !:
+    INTEGER(iwp) ::  nzb_si  !:
+    INTEGER(iwp) ::  nzt_l   !:
+    INTEGER(iwp) ::  vi      !:
+
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE   ::  vertical_influence  !:
+
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  corner_nl  !:
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  corner_nr  !:
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  corner_sl  !:
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  corner_sr  !:
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  wall_l     !:
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  wall_n     !:
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  wall_r     !:
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  wall_s     !:
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nzb_local  !:
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nzb_tmp    !:
+
+    LOGICAL :: flag_set = .FALSE.  !:
+
+    REAL(wp) ::  dx_l          !:
+    REAL(wp) ::  dy_l          !:
+    REAL(wp) ::  dz_stretched  !:
+
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  topo_height  !:
 
     
Index: /palm/trunk/SOURCE/init_masks.f90
===================================================================
--- /palm/trunk/SOURCE/init_masks.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_masks.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -50,23 +55,4 @@
 ! 807 2012-01-25 11:53:51Z maronga
 ! New cpp directive "__check" implemented which is used by check_namelist_files
-!
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt
-!
-! 595 2010-11-12 09:52:10Z helmke
-! Calculation of z locations for masked output changed
-!
-! 564 2010-09-30 13:18:59Z helmke
-! assignment of mask_xyz_loop added, palm message identifiers of masked output
-! changed 
-!/localdata/raasch.14299
-! 557 2010-09-07 14:50:07Z weinreis 
-! bugfix message string in set_mask_locations
-!
-! 553 2010-09-01 14:09:06Z weinreis
-! parameters for masked output are replaced by arrays
-!
-! 493 2010-03-01 08:30:24Z raasch
-! netcdf_format_mask* and format_parallel_io replaced by netcdf_data_format
 !
 ! 410 2009-12-04 17:05:40Z letzel
@@ -79,22 +65,54 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
-    USE netcdf_control
-    USE particle_attributes
+    USE arrays_3d,                                                             &
+        ONLY:  zu, zw
+
+    USE control_parameters,                                                    &
+        ONLY:  constant_diffusion, cloud_droplets, cloud_physics,              &
+               data_output_masks, data_output_masks_user,                      &
+               doav, doav_n, domask, domask_no, dz, dz_stretch_level, humidity,&
+               mask, masks, mask_scale, mask_i,                                &
+               mask_i_global, mask_j, mask_j_global, mask_k, mask_k_global,    &
+               mask_loop, mask_size, mask_size_l, mask_start_l, mask_x,        &
+               mask_x_loop, mask_xyz_dimension, mask_y, mask_y_loop, mask_z,   &
+               mask_z_loop, max_masks,  message_string, mid,                   &
+               netcdf_data_format, passive_scalar, ocean
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nx, nxl, nxr, ny, nyn, nys, nz, nzb, nzt
+
+    USE kinds
+
+    USE netcdf_control,                                                        &
+        ONLY:  domask_unit
+
+    USE particle_attributes,                                                   &
+        ONLY:  particle_advection
+
     USE pegrid
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=6)   ::  var
-    CHARACTER (LEN=7)   ::  unit
-    CHARACTER (LEN=10), DIMENSION(max_masks,100) ::  do_mask, do_mask_user
-
-    INTEGER :: i, ilen, ind(6), ind_array(1), j, k, n, sender
-    INTEGER, DIMENSION(:), ALLOCATABLE ::  tmp_array
-
-    LOGICAL ::  found
+    CHARACTER (LEN=6) ::  var  !:
+    CHARACTER (LEN=7) ::  unit !:
+    
+    CHARACTER (LEN=10), DIMENSION(max_masks,100) ::  do_mask      !:
+    CHARACTER (LEN=10), DIMENSION(max_masks,100) ::  do_mask_user !:
+
+    INTEGER(iwp) ::  i            !: 
+    INTEGER(iwp) ::  ilen         !:
+    INTEGER(iwp) ::  ind(6)       !:
+    INTEGER(iwp) ::  ind_array(1) !:
+    INTEGER(iwp) ::  j            !:
+    INTEGER(iwp) ::  k            !:
+    INTEGER(iwp) ::  n            !:
+    INTEGER(iwp) ::  sender       !:
+    
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  tmp_array !:
+
+    LOGICAL ::  found !:
 !
 !-- Allocation and initialization
@@ -480,8 +498,22 @@
        IMPLICIT NONE
 
-       CHARACTER (LEN=2) :: dxyz_string, nxyz_string
-       INTEGER  ::  count, count_l, dim, m, loop_begin, loop_end, loop_stride, &
-                    lb, nxyz, ub
-       REAL     ::  dxyz, ddxyz, tmp1, tmp2
+       CHARACTER (LEN=2) ::  dxyz_string !:
+       CHARACTER (LEN=2) ::  nxyz_string !:
+       
+       INTEGER(iwp)  ::  count       !:
+       INTEGER(iwp)  ::  count_l     !:
+       INTEGER(iwp)  ::  dim         !:
+       INTEGER(iwp)  ::  m           !:
+       INTEGER(iwp)  ::  loop_begin  !:
+       INTEGER(iwp)  ::  loop_end    !:
+       INTEGER(iwp)  ::  loop_stride !:
+       INTEGER(iwp)  ::  lb          !:
+       INTEGER(iwp)  ::  nxyz        !:
+       INTEGER(iwp)  ::  ub          !:
+       
+       REAL(wp)      ::  dxyz  !:
+       REAL(wp)      ::  ddxyz !:
+       REAL(wp)      ::  tmp1  !:
+       REAL(wp)      ::  tmp2  !:
 
        count = 0;  count_l = 0;  ddxyz = 1.0 / dxyz;  tmp1 = 0.0;  tmp2 = 0.0
Index: /palm/trunk/SOURCE/init_ocean.f90
===================================================================
--- /palm/trunk/SOURCE/init_ocean.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_ocean.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -32,11 +37,4 @@
 ! code put under GPL (PALM 3.9)
 !
-! 388 2009-09-23 09:40:33Z raasch
-! Bugfix: Initial profiles of hydrostatic pressure and density are calculated
-! iteratively. First calculation of hyp(0) changed.
-!
-! 124 2007-10-19 15:47:46Z raasch
-! Bugfix: Initial density rho is calculated
-!
 ! 97 2007-06-21 08:23:15Z raasch
 ! Initial revision
@@ -47,19 +45,33 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE eqn_state_seawater_mod
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  dzu, hyp, pt_init, ref_state, sa_init, zu, zw
+
+    USE control_parameters,                                                    &
+        ONLY:  g, prho_reference, rho_surface, rho_reference,                  &
+               surface_pressure, use_single_reference_value
+
+    USE eqn_state_seawater_mod,                                                &
+        ONLY:  eqn_state_seawater, eqn_state_seawater_func
+
+    USE indices,                                                               &
+        ONLY:  nzb, nzt
+
+    USE kinds
+
     USE pegrid
-    USE statistics
+
+    USE statistics,                                                            &
+        ONLY:  hom, statistic_regions
 
     IMPLICIT NONE
 
-    INTEGER ::  k, n
+    INTEGER(iwp) ::  k !:
+    INTEGER(iwp) ::  n !:
 
-    REAL    ::  sa_l, pt_l
+    REAL(wp)     ::  pt_l !:
+    REAL(wp)     ::  sa_l !:
 
-    REAL, DIMENSION(nzb:nzt+1) ::  rho_init
+    REAL(wp), DIMENSION(nzb:nzt+1) ::  rho_init !:
 
     ALLOCATE( hyp(nzb:nzt+1) )
@@ -119,5 +131,5 @@
 
        prho_reference = prho_reference + dzu(k+1) * &
-                        eqn_state_seawater_func( 0.0, pt_l, sa_l )
+                        eqn_state_seawater_func( 0.0_wp, pt_l, sa_l )
 
     ENDDO
Index: /palm/trunk/SOURCE/init_pegrid.f90
===================================================================
--- /palm/trunk/SOURCE/init_pegrid.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_pegrid.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -69,87 +74,4 @@
 ! 807 2012-01-25 11:53:51Z maronga
 ! New cpp directive "__check" implemented which is used by check_namelist_files
-!
-! 780 2011-11-10 07:16:47Z raasch
-! Bugfix for rev 778: Misplaced error message moved to the rigth place
-!
-! 778 2011-11-07 14:18:25Z fricke
-! Calculation of subdomain_size now considers the number of ghost points.
-! Further coarsening on PE0 is now possible for multigrid solver if the 
-! collected field has more grid points than the subdomain of an PE.
-!
-! 759 2011-09-15 13:58:31Z raasch
-! calculation of number of io_blocks and the io_group to which the respective
-! PE belongs
-!
-! 755 2011-08-29 09:55:16Z witha
-! 2d-decomposition is default for lcflow (ForWind cluster in Oldenburg)
-!
-! 722 2011-04-11 06:21:09Z raasch
-! Bugfix: bc_lr/ns_cyc/dirrad/raddir replaced by bc_lr/ns, because variables
-!         are not yet set here; grid_level set to 0
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 707 2011-03-29 11:39:40Z raasch
-! bc_lr/ns replaced by bc_lr/ns_cyc/dirrad/raddir
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Moved determination of target_id's from init_coupling
-! Determination of parameters needed for coupling (coupling_topology, ngp_a, 
-! ngp_o) with different grid/processor-topology in ocean and atmosphere
-! Adaption of ngp_xy, ngp_y to a dynamic number of ghost points.
-! The maximum_grid_level changed from 1 to 0. 0 is the normal grid, 1 to 
-! maximum_grid_level the grids for multigrid, in which 0 and 1 are normal grids.
-! This distinction is due to reasons of data exchange and performance for the 
-! normal grid and grids in poismg.
-! The definition of MPI-Vectors adapted to a dynamic numer of ghost points.
-! New MPI-Vectors for data exchange between left and right boundaries added. 
-! This is due to reasons of performance (10% faster).
-!
-! 646 2010-12-15 13:03:52Z raasch
-! lctit is now using a 2d decomposition by default
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 438 2010-02-01 04:32:43Z raasch
-! 2d-decomposition is default for Cray-XT machines
-!
-! 274 2009-03-26 15:11:21Z heinze
-! Output of messages replaced by message handling routine.
-!
-! 206 2008-10-13 14:59:11Z raasch
-! Implementation of a MPI-1 coupling: added __parallel within the __mpi2 part
-! 2d-decomposition is default on SGI-ICE systems
-!
-! 197 2008-09-16 15:29:03Z raasch
-! multigrid levels are limited by subdomains if mg_switch_to_pe0_level = -1,
-! nz is used instead nnz for calculating mg-levels
-! Collect on PE0 horizontal index bounds from all other PEs,
-! broadcast the id of the inflow PE (using the respective communicator)
-!
-! 114 2007-10-10 00:03:15Z raasch
-! Allocation of wall flag arrays for multigrid solver
-!
-! 108 2007-08-24 15:10:38Z letzel
-! Intercommunicator (comm_inter) and derived data type (type_xy) for
-! coupled model runs created, assign coupling_mode_remote,
-! indices nxlu and nysv are calculated (needed for non-cyclic boundary
-! conditions)
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Cpp-directive lcmuk changed to intel_openmp_bug, setting of host on lcmuk by
-! cpp-directive removed
-!
-! 75 2007-03-22 09:54:05Z raasch
-! uxrp, vynp eliminated,
-! dirichlet/neumann changed to dirichlet/radiation, etc.,
-! poisfft_init is only called if fft-solver is switched on
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.28  2006/04/26 13:23:32  raasch
-! lcmuk does not understand the !$ comment so a cpp-directive is required
 !
 ! Revision 1.1  1997/07/24 11:15:09  raasch
@@ -164,27 +86,69 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  bc_lr, bc_ns, coupling_mode, coupling_topology, dt_dosp,        &
+               gathered_size, grid_level, grid_level_count, host, inflow_l,    &
+               inflow_n, inflow_r, inflow_s, io_blocks, io_group,              &  
+               maximum_grid_level, maximum_parallel_io_streams, message_string,&
+               mg_switch_to_pe0_level, momentum_advec, psolver, outflow_l,     &
+               outflow_n, outflow_r, outflow_s, recycling_width, scalar_advec, &
+               subdomain_size 
+
+    USE grid_variables,                                                        &
+        ONLY:  dx
+        
+    USE indices,                                                               &
+        ONLY:  mg_loc_ind, nbgp, nnx, nny, nnz, nx, nx_a, nx_o, nxl, nxl_mg,   &
+               nxlu, nxr, nxr_mg, ny, ny_a, ny_o, nyn, nyn_mg, nys, nys_mg,    &
+               nysv, nz, nzb, nzt, nzt_mg, wall_flags_1, wall_flags_2,         &
+               wall_flags_3, wall_flags_4, wall_flags_5, wall_flags_6,         &
+               wall_flags_7, wall_flags_8, wall_flags_9, wall_flags_10
+
+    USE kinds
+      
     USE pegrid
-    USE statistics
-    USE transpose_indices
-
-
+ 
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxl_yd, nxl_z, nxr_y, nxr_yd, nxr_z, nyn_x, nyn_z, nys_x,&
+               nys_z, nzb_x, nzb_y, nzb_yd, nzt_x, nzt_yd, nzt_y
 
     IMPLICIT NONE
 
-    INTEGER ::  i, id_inflow_l, id_recycling_l, ind(5), j, k,                &
-                maximum_grid_level_l, mg_switch_to_pe0_level_l, mg_levels_x, &
-                mg_levels_y, mg_levels_z, nnx_y, nnx_z, nny_x, nny_z, nnz_x, &
-                nnz_y, numproc_sqr, nxl_l, nxr_l, nyn_l, nys_l,    &
-                nzb_l, nzt_l, omp_get_num_threads
-
-    INTEGER, DIMENSION(:), ALLOCATABLE ::  ind_all, nxlf, nxrf, nynf, nysf
-
-    INTEGER, DIMENSION(2) :: pdims_remote
+    INTEGER(iwp) ::  i                        !:
+    INTEGER(iwp) ::  id_inflow_l              !:
+    INTEGER(iwp) ::  id_recycling_l           !:
+    INTEGER(iwp) ::  ind(5)                   !:
+    INTEGER(iwp) ::  j                        !:
+    INTEGER(iwp) ::  k                        !:
+    INTEGER(iwp) ::  maximum_grid_level_l     !:
+    INTEGER(iwp) ::  mg_levels_x              !:
+    INTEGER(iwp) ::  mg_levels_y              !:
+    INTEGER(iwp) ::  mg_levels_z              !:
+    INTEGER(iwp) ::  mg_switch_to_pe0_level_l !:
+    INTEGER(iwp) ::  nnx_y                    !:
+    INTEGER(iwp) ::  nnx_z                    !:
+    INTEGER(iwp) ::  nny_x                    !:
+    INTEGER(iwp) ::  nny_z                    !:
+    INTEGER(iwp) ::  nnz_x                    !:
+    INTEGER(iwp) ::  nnz_y                    !:
+    INTEGER(iwp) ::  numproc_sqr              !:
+    INTEGER(iwp) ::  nxl_l                    !:
+    INTEGER(iwp) ::  nxr_l                    !:
+    INTEGER(iwp) ::  nyn_l                    !:
+    INTEGER(iwp) ::  nys_l                    !:
+    INTEGER(iwp) ::  nzb_l                    !:
+    INTEGER(iwp) ::  nzt_l                    !:
+    INTEGER(iwp) ::  omp_get_num_threads      !:
+
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ind_all !:
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  nxlf    !:
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  nxrf    !:
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  nynf    !:
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  nysf    !:
+
+    INTEGER(iwp), DIMENSION(2) :: pdims_remote          !:
 
 #if defined( __mpi2 )
-    LOGICAL ::  found
+    LOGICAL ::  found                                   !:
 #endif
 
Index: /palm/trunk/SOURCE/init_pt_anomaly.f90
===================================================================
--- /palm/trunk/SOURCE/init_pt_anomaly.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_pt_anomaly.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -32,19 +37,4 @@
 ! Modification of the amplitude to obtain a visible temperature perturbation.
 !
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Call of exchange_horiz are modified.
-!
-! 75 2007-03-22 09:54:05Z raasch
-! 2nd+3rd argument removed from exchange horiz
-!
-! 19 2007-02-23 04:53:48Z raasch
-! Calculation extended for gridpoint nzt
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.7  2005/03/26 20:36:55  raasch
-! Arguments for non-cyclic boundary conditions added to argument list of
-! routine exchange_horiz
-!
 ! Revision 1.1  1997/08/29 08:58:56  raasch
 ! Initial revision
@@ -56,15 +46,31 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE constants
-    USE grid_variables
-    USE indices
-    USE control_parameters
+    USE arrays_3d,                                                             &
+        ONLY:  pt, zu
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nbgp, nx, nxl, nxr, nyn, nys, nzb, nzt
+        
+    USE kinds
 
     IMPLICIT NONE
 
-    INTEGER ::  i, ic, j, jc, k, kc
-    REAL    ::  betrag, radius, rc, x, y, z
-
+    INTEGER(iwp) ::  i  !:
+    INTEGER(iwp) ::  ic !:
+    INTEGER(iwp) ::  j  !:
+    INTEGER(iwp) ::  jc !:
+    INTEGER(iwp) ::  k  !:
+    INTEGER(iwp) ::  kc !:
+    
+    REAL(wp)     ::  betrag !:
+    REAL(wp)     ::  radius !:
+    REAL(wp)     ::  rc     !:
+    REAL(wp)     ::  x      !:
+    REAL(wp)     ::  y      !:
+    REAL(wp)     ::  z      !:
+    
 !
 !-- Defaults: radius rc, strength z,
Index: /palm/trunk/SOURCE/init_rankine.f90
===================================================================
--- /palm/trunk/SOURCE/init_rankine.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_rankine.f90	(revision 1320)
@@ -20,4 +20,10 @@
 ! Current revisions:
 ! -----------------
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -27,20 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng. 
-! Calls of exchange_horiz are modified.
-!
-! 107 2007-08-17 13:54:45Z raasch
-! Initial profiles are reset to constant profiles
-!
-! 75 2007-03-22 09:54:05Z raasch
-! uxrp, vynp eliminated, 2nd+3rd argument removed from exchange horiz
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.11  2005/03/26 20:38:49  raasch
-! Arguments for non-cyclic boundary conditions added to argument list of
-! routine exchange_horiz
 !
 ! Revision 1.1  1997/08/11 06:18:43  raasch
@@ -54,14 +44,39 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE constants
-    USE grid_variables
-    USE indices
-    USE control_parameters
+    USE arrays_3d,                                                             &
+        ONLY:  pt, pt_init, u, u_init, v, v_init
+
+    USE control_parameters,                                                    &
+        ONLY:  initializing_actions, n_sor, nsor, nsor_ini   
+
+    USE constants,                                                             &
+        ONLY:  pi
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy 
+
+    USE indices,                                                               &
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt     
+                
+    USE kinds
 
     IMPLICIT NONE
 
-    INTEGER ::  i, ic, j, jc, k, kc1, kc2
-    REAL    ::  alpha, betrag, radius, rc, uw, vw, x, y
+    INTEGER(iwp) ::  i   !:
+    INTEGER(iwp) ::  ic  !:
+    INTEGER(iwp) ::  j   !:
+    INTEGER(iwp) ::  jc  !:
+    INTEGER(iwp) ::  k   !:
+    INTEGER(iwp) ::  kc1 !:
+    INTEGER(iwp) ::  kc2 !:
+    
+    REAL(wp)     ::  alpha  !:
+    REAL(wp)     ::  betrag !:
+    REAL(wp)     ::  radius !:
+    REAL(wp)     ::  rc     !:
+    REAL(wp)     ::  uw     !:
+    REAL(wp)     ::  vw     !:
+    REAL(wp)     ::  x      !:
+    REAL(wp)     ::  y      !:
 
 !
Index: /palm/trunk/SOURCE/init_slope.f90
===================================================================
--- /palm/trunk/SOURCE/init_slope.f90	(revision 1319)
+++ /palm/trunk/SOURCE/init_slope.f90	(revision 1320)
@@ -20,4 +20,10 @@
 ! Current revisions:
 ! -----------------
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -27,16 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! Feb. 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.5  2006/02/23 12:35:34  raasch
-! nanz_2dh renamed ngp_2dh
 !
 ! Revision 1.1  2000/04/27 07:06:24  raasch
@@ -52,16 +46,37 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE constants
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  pt, pt_init, pt_slope_ref, zu
+        
+    USE constants,                                                             &
+        ONLY:  pi
+                    
+    USE control_parameters,                                                    &
+        ONLY:  alpha_surface, initializing_actions, pt_slope_offset,           &
+               pt_surface, pt_vertical_gradient, sin_alpha_surface
+        
+    USE grid_variables,                                                        &
+        ONLY:  dx
+        
+    USE indices,                                                               &
+        ONLY:  ngp_2dh, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
+        
+    USE kinds
+
     USE pegrid
-    USE control_parameters
+
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k
-    REAL    ::  alpha, height, pt_value, radius
-    REAL, DIMENSION(:), ALLOCATABLE ::  pt_init_local
+    INTEGER(iwp) ::  i        !:
+    INTEGER(iwp) ::  j        !:
+    INTEGER(iwp) ::  k        !:
+    
+    REAL(wp)     ::  alpha    !:
+    REAL(wp)     ::  height   !:
+    REAL(wp)     ::  pt_value !:
+    REAL(wp)     ::  radius   !:
+    
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  pt_init_local !:
 
 !
Index: /palm/trunk/SOURCE/interaction_droplets_ptq.f90
===================================================================
--- /palm/trunk/SOURCE/interaction_droplets_ptq.f90	(revision 1319)
+++ /palm/trunk/SOURCE/interaction_droplets_ptq.f90	(revision 1320)
@@ -60,8 +60,14 @@
     SUBROUTINE interaction_droplets_ptq
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  pt_p, ql_c, q_p
+           
+       USE cloud_parameters,                                                   &
+           ONLY:  l_d_cp, pt_d_t
+           
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb_2d, nzt
+           
+       USE kinds
 
        USE pegrid
@@ -69,5 +75,7 @@
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
 
  
@@ -89,8 +97,15 @@
     SUBROUTINE interaction_droplets_ptq_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  pt_p, ql_c, q_p
+
+       USE cloud_parameters,                                                   &
+           ONLY:  l_d_cp, pt_d_t
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nyn, nys, nzb_2d, nzt
+
+       USE kinds,                                                              &
+           ONLY:  iwp, wp
 
        USE pegrid
@@ -98,5 +113,7 @@
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
 
 
Index: /palm/trunk/SOURCE/local_flush.f90
===================================================================
--- /palm/trunk/SOURCE/local_flush.f90	(revision 1319)
+++ /palm/trunk/SOURCE/local_flush.f90	(revision 1320)
@@ -20,5 +20,8 @@
 ! Current revisions:
 ! -----------------
-! 
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -37,5 +40,7 @@
 !------------------------------------------------------------------------------!
 
-    INTEGER ::  file_id
+    USE kinds
+
+    INTEGER(iwp) ::  file_id !:
 
 #if defined( __ibm )
Index: /palm/trunk/SOURCE/local_getenv.f90
===================================================================
--- /palm/trunk/SOURCE/local_getenv.f90	(revision 1319)
+++ /palm/trunk/SOURCE/local_getenv.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -28,13 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Preprocessor directives for old systems removed
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.5  2003/05/09 14:37:07  raasch
-! On the MUK cluster, only PE0 is able to read environment variables.
-! Therefore, they have to be communicated via broadcast to the other PEs.
 !
 ! Revision 1.1  1997/08/11 06:21:01  raasch
@@ -47,11 +43,17 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+        
 #if defined( __lcmuk )
     USE pegrid
 #endif
-    CHARACTER (LEN=*) ::  var, value
-    INTEGER           ::  ivalue, ivar
+    CHARACTER (LEN=*) ::  value  !:
+    CHARACTER (LEN=*) ::  var    !:
+    
+    INTEGER(iwp)      ::  ivalue !:
+    INTEGER(iwp)      ::  ivar   !:
 #if defined( __lcmuk )
-    INTEGER            ::  i, ia(20)
+    INTEGER(iwp)      ::  i      !:
+    INTEGER(iwp)      ::  ia(20) !:
 #endif
 
Index: /palm/trunk/SOURCE/local_stop.f90
===================================================================
--- /palm/trunk/SOURCE/local_stop.f90	(revision 1319)
+++ /palm/trunk/SOURCE/local_stop.f90	(revision 1320)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! revision history before 2012 removed,
 !
 ! Former revisions:
@@ -35,23 +36,4 @@
 ! New cpp directive "__check" implemented which is used by check_namelist_files
 !
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Exchange of terminate_coupled between ocean and atmosphere via PE0
-!
-! 213 2008-11-13 10:26:18Z raasch
-! Implementation of a MPI-1 coupling: replaced myid with target_id.
-! The uncoupled case allows stop or mpi_abort depending on new steering
-! parameter abort_mode, which is set in routine message.
-!
-! 147 2008-02-01 12:41:46Z raasch
-! Bugfix: a stop command was missing in some cases of the parallel branch
-!
-! 108 2007-08-24 15:10:38Z letzel
-! modifications to terminate coupled runs
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.2  2003/03/16 09:40:28  raasch
-! Two underscores (_) are placed in front of all define-strings
-!
 ! Revision 1.1  2002/12/19 15:46:23  raasch
 ! Initial revision
@@ -64,5 +46,9 @@
 
     USE pegrid
-    USE control_parameters
+    
+    USE control_parameters,                                                    &
+        ONLY:  abort_mode, coupling_mode, coupling_mode_remote, dt_restart,    &
+               stop_dt, terminate_coupled, terminate_coupled_remote,           &
+               terminate_run, time_restart
 
 
Index: /palm/trunk/SOURCE/local_system.f90
===================================================================
--- /palm/trunk/SOURCE/local_system.f90	(revision 1319)
+++ /palm/trunk/SOURCE/local_system.f90	(revision 1320)
@@ -20,5 +20,7 @@
 ! Current revisions:
 ! -----------------
-! 
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,12 +30,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Preprocessor directives for old systems removed
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.4  2003/03/16 09:40:33  raasch
-! Two underscores (_) are placed in front of all define-strings
 !
 ! Revision 1.1  1997/09/03 06:27:27  raasch
@@ -46,5 +40,5 @@
 !------------------------------------------------------------------------------!
 
-    CHARACTER (LEN=*) ::  command
+    CHARACTER (LEN=*) ::  command !:
 
     CALL SYSTEM( command )
Index: /palm/trunk/SOURCE/local_tremain.f90
===================================================================
--- /palm/trunk/SOURCE/local_tremain.f90	(revision 1319)
+++ /palm/trunk/SOURCE/local_tremain.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,17 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 225 2009-01-26 14:44:20Z raasch
-! Type of count and count_rate changed to INTEGER(8) in order to avoid out of
-! range problems (which result in measured negative time intervals)
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Preprocessor strings for different linux clusters changed to "lc",
-! preprocessor directives for old systems removed
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.14  2006/06/02 15:20:33  raasch
-! Extended to TIT Sun Fire X4600 System (lctit)
 !
 ! Revision 1.1  1998/03/18 20:14:47  raasch
@@ -51,17 +43,24 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE cpulog
+    USE control_parameters,                                                    &
+        ONLY:  maximum_cpu_time_allowed
+
+    USE cpulog,                                                                &
+        ONLY:  initial_wallclock_time
+
+    USE kinds
+
     USE pegrid
 
     IMPLICIT NONE
 
-    REAL ::  remaining_time
+    REAL(wp)     ::  remaining_time        !:
 #if defined( __ibm )
-    INTEGER(8) ::  IRTC
-    REAL       ::  actual_wallclock_time
+    INTEGER(idp) ::  IRTC                  !:
+    REAL(wp)     ::  actual_wallclock_time !:
 #elif defined( __lc )
-    INTEGER(8) ::  count, count_rate
-    REAL       ::  actual_wallclock_time
+    INTEGER(idp) ::  count                 !:
+    INTEGER(idp) ::  count_rate            !:
+    REAL(wp)     ::  actual_wallclock_time !:
 #endif
 
Index: /palm/trunk/SOURCE/local_tremain_ini.f90
===================================================================
--- /palm/trunk/SOURCE/local_tremain_ini.f90	(revision 1319)
+++ /palm/trunk/SOURCE/local_tremain_ini.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -32,17 +37,4 @@
 ! code put under GPL (PALM 3.9)
 !
-! 225 2009-01-26 14:44:20Z raasch
-! Type of count and count_rate changed to INTEGER(8) in order to avoid out of
-! range problems (which result in measured negative time intervals)
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Cpp-directive lctit renamed lc
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.13  2007/02/11 13:07:03  raasch
-! Allowed cpu limit is now read from file instead of reading the value from
-! environment variable (see routine parin)
-!
 ! Revision 1.1  1998/03/18 20:15:05  raasch
 ! Initial revision
@@ -53,14 +45,17 @@
 ! Initialization of CPU-time measurements for different operating systems
 !------------------------------------------------------------------------------!
-
-    USE control_parameters
-    USE cpulog
+      
+    USE cpulog,                                                                &
+        ONLY:  initial_wallclock_time
+        
+    USE kinds
 
     IMPLICIT NONE
 
 #if defined( __ibm )
-    INTEGER(8)         ::  IRTC
+    INTEGER(idp)     ::  IRTC       !:
 #elif defined( __lc )
-    INTEGER(8)         ::  count, count_rate
+    INTEGER(idp)     ::  count      !:
+    INTEGER(idp)     ::  count_rate !:
 #endif
 
Index: /palm/trunk/SOURCE/lpm.f90
===================================================================
--- /palm/trunk/SOURCE/lpm.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -59,14 +64,4 @@
 ! wang_collision_kernel renamed wang_kernel
 !
-! 799 2011-12-21 17:48:03Z franke
-! Implementation of Wang collision kernel and corresponding new parameter 
-! wang_collision_kernel
-!
-! 792 2011-12-01 raasch
-! particle arrays (particles, particles_temp) implemented as pointers in
-! order to speed up sorting (see routine sort_particles)
-!
-! 759 2011-09-15 13:58:31Z raasch
-! Splitting of parallel I/O (routine write_particles)
 !
 ! Revision 1.1  1999/11/25 16:16:06  raasch
@@ -79,14 +74,32 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE particle_attributes
+    USE arrays_3d,                                                             &
+        ONLY:  ql_c, ql_v, ql_vp
+
+    USE control_parameters,                                                    &
+        ONLY:  cloud_droplets, dt_3d, dt_3d_reached, dt_3d_reached_l,          &
+               molecular_viscosity, simulated_time
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point, log_point_s
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  collision_kernel, deleted_particles, dt_sort_particles,         &
+               deleted_tails, dt_write_particle_data, dt_prel, end_time_prel,  &
+               number_of_particles, number_of_particle_groups,particles,       &
+               particle_groups, particle_mask, trlp_count_sum, tail_mask,      &
+               time_prel, time_sort_particles, time_write_particle_data,       &
+               trlp_count_recv_sum, trnp_count_sum, trnp_count_recv_sum,       &
+               trrp_count_sum, trrp_count_recv_sum, trsp_count_sum,            &
+               trsp_count_recv_sum, use_particle_tails, use_sgs_for_particles, &
+               write_particle_statistics
+
     USE pegrid
-    USE statistics
 
     IMPLICIT NONE
 
-    INTEGER ::  m
+    INTEGER(iwp) ::  m                       !:
 
 
Index: /palm/trunk/SOURCE/lpm_advec.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_advec.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_advec.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -44,33 +49,101 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
-    USE particle_attributes
-    USE statistics
+    USE arrays_3d,                                                             &
+        ONLY:  de_dx, de_dy, de_dz, diss, e, u, us, usws, v, vsws, w, z0, zu, zw
+
+    USE control_parameters,                                                    &
+        ONLY:  atmos_ocean_sign, cloud_droplets, dt_3d, dt_3d_reached_l, dz,   &
+               g, kappa, molecular_viscosity, prandtl_layer, topography,       &
+               u_gtrans, v_gtrans
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx, dx, ddy, dy
+        
+    USE indices,                                                               &
+        ONLY:  nzb, nzb_s_inner, nzt
+        
+    USE kinds
+    
+    USE particle_attributes,                                                   &
+        ONLY:  c_0, density_ratio, dt_min_part, iran_part, log_z_z0,           &
+               number_of_particles, number_of_sublayers, particles,            &
+               particle_groups, offset_ocean_nzt, offset_ocean_nzt_m1,         &
+               sgs_wfu_part, sgs_wfv_part, sgs_wfw_part, use_sgs_for_particles,&
+               vertical_particle_advection, z0_av_global
+        
+    USE statistics,                                                            &
+        ONLY:  hom
+        
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, n
-
-    REAL ::  aa, bb, cc, dd, dens_ratio, exp_arg, exp_term, gg, u_int,  &
-             u_int_l, u_int_u, v_int, v_int_l, v_int_u, w_int, w_int_l, &
-             w_int_u, x, y
-
-
-    INTEGER ::  agp, kw, num_gp
-    INTEGER ::  gp_outside_of_building(1:8)
-
-    REAL ::  d_sum, de_dx_int, de_dx_int_l, de_dx_int_u, de_dy_int,       &
-             de_dy_int_l, de_dy_int_u, de_dt, de_dt_min, de_dz_int,       &
-             de_dz_int_l, de_dz_int_u, diss_int, diss_int_l, diss_int_u,  &
-             dt_gap, dt_particle, dt_particle_m, e_int, e_int_l, e_int_u, &
-             e_mean_int, fs_int, lagr_timescale, random_gauss, vv_int
-
-    REAL ::    height_int, height_p, log_z_z0_int, us_int, z_p, d_z_p_z0
-
-    REAL ::  location(1:30,1:3)
-    REAL, DIMENSION(1:30) ::  de_dxi, de_dyi, de_dzi, dissi, d_gp_pl, ei
+    INTEGER(iwp) ::  agp                         !:
+    INTEGER(iwp) ::  gp_outside_of_building(1:8) !:
+    INTEGER(iwp) ::  i                           !:
+    INTEGER(iwp) ::  j                           !:
+    INTEGER(iwp) ::  k                           !:
+    INTEGER(iwp) ::  kw                          !:
+    INTEGER(iwp) ::  n                           !:
+    INTEGER(iwp) ::  num_gp                      !:
+
+    REAL(wp) ::  aa                 !:
+    REAL(wp) ::  bb                 !:
+    REAL(wp) ::  cc                 !:
+    REAL(wp) ::  d_sum              !:
+    REAL(wp) ::  d_z_p_z0           !:
+    REAL(wp) ::  dd                 !:
+    REAL(wp) ::  de_dx_int          !:
+    REAL(wp) ::  de_dx_int_l        !:
+    REAL(wp) ::  de_dx_int_u        !:
+    REAL(wp) ::  de_dy_int          !:
+    REAL(wp) ::  de_dy_int_l        !:
+    REAL(wp) ::  de_dy_int_u        !:
+    REAL(wp) ::  de_dt              !:
+    REAL(wp) ::  de_dt_min          !:
+    REAL(wp) ::  de_dz_int          !:
+    REAL(wp) ::  de_dz_int_l        !:
+    REAL(wp) ::  de_dz_int_u        !:
+    REAL(wp) ::  dens_ratio         !:
+    REAL(wp) ::  diss_int           !:
+    REAL(wp) ::  diss_int_l         !:
+    REAL(wp) ::  diss_int_u         !:
+    REAL(wp) ::  dt_gap             !:
+    REAL(wp) ::  dt_particle        !:
+    REAL(wp) ::  dt_particle_m      !:
+    REAL(wp) ::  e_int              !:
+    REAL(wp) ::  e_int_l            !:
+    REAL(wp) ::  e_int_u            !:
+    REAL(wp) ::  e_mean_int         !:
+    REAL(wp) ::  exp_arg            !:
+    REAL(wp) ::  exp_term           !:
+    REAL(wp) ::  fs_int             !:
+    REAL(wp) ::  gg                 !:
+    REAL(wp) ::  height_int         !:
+    REAL(wp) ::  height_p           !:
+    REAL(wp) ::  lagr_timescale     !:
+    REAL(wp) ::  location(1:30,1:3) !:
+    REAL(wp) ::  log_z_z0_int       !:
+    REAL(wp) ::  random_gauss       !:
+    REAL(wp) ::  u_int              !:
+    REAL(wp) ::  u_int_l            !:
+    REAL(wp) ::  u_int_u            !:
+    REAL(wp) ::  us_int             !:
+    REAL(wp) ::  v_int              !:
+    REAL(wp) ::  v_int_l            !:
+    REAL(wp) ::  v_int_u            !:
+    REAL(wp) ::  vv_int             !:
+    REAL(wp) ::  w_int              !:
+    REAL(wp) ::  w_int_l            !:
+    REAL(wp) ::  w_int_u            !:
+    REAL(wp) ::  x                  !:
+    REAL(wp) ::  y                  !:
+    REAL(wp) ::  z_p                !:    
+
+    REAL(wp), DIMENSION(1:30) ::  d_gp_pl !:
+    REAL(wp), DIMENSION(1:30) ::  de_dxi  !:
+    REAL(wp), DIMENSION(1:30) ::  de_dyi  !:
+    REAL(wp), DIMENSION(1:30) ::  de_dzi  !:
+    REAL(wp), DIMENSION(1:30) ::  dissi   !:
+    REAL(wp), DIMENSION(1:30) ::  ei      !:
 
 !
Index: /palm/trunk/SOURCE/lpm_boundary_conds.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_boundary_conds.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_boundary_conds.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -26,7 +31,4 @@
 ! $Id$
 !
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
-!
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
@@ -38,7 +40,4 @@
 ! 824 2012-02-17 09:09:57Z raasch
 ! particle attributes speed_x|y|z_sgs renamed rvar1|2|3
-!
-! 150 2008-02-29 08:19:58Z raasch
-! Vertical index calculations adjusted for ocean runs.
 !
 ! Initial version (2007/03/09)
@@ -61,27 +60,75 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
-    USE particle_attributes
+    USE arrays_3d,                                                             &
+        ONLY:  zu, zw
+
+    USE control_parameters,                                                    &
+        ONLY:  dz, message_string, particle_maximum_age
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx, dx, ddy, dy
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys, nz, nzb_s_inner
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  deleted_particles, deleted_tails, ibc_par_b, ibc_par_t,         &
+               number_of_particles, particles, particle_mask,                  &
+               particle_tail_coordinates, particle_type, offset_ocean_nzt_m1,  &
+               tail_mask, use_particle_tails, use_sgs_for_particles
+
     USE pegrid
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  range
-
-    INTEGER ::  i, inc, ir, i1, i2, i3, i5, j, jr, j1, j2, j3, j5, k, k1, k2, &
-                k3, k5, n, nn, t_index, t_index_number
-
-    LOGICAL ::  reflect_x, reflect_y, reflect_z
-
-    REAL ::  dt_particle, pos_x, pos_x_old, pos_y, pos_y_old, pos_z, &
-             pos_z_old, prt_x, prt_y, prt_z, tmp_t, xline, yline, zline
-
-    REAL ::  t(1:200)
-
-
+    CHARACTER (LEN=*) ::  range     !:
+    
+    INTEGER(iwp) ::  i              !:
+    INTEGER(iwp) ::  inc            !:
+    INTEGER(iwp) ::  ir             !:
+    INTEGER(iwp) ::  i1             !:
+    INTEGER(iwp) ::  i2             !:
+    INTEGER(iwp) ::  i3             !:
+    INTEGER(iwp) ::  i5             !:
+    INTEGER(iwp) ::  j              !:
+    INTEGER(iwp) ::  jr             !:
+    INTEGER(iwp) ::  j1             !:
+    INTEGER(iwp) ::  j2             !:
+    INTEGER(iwp) ::  j3             !:
+    INTEGER(iwp) ::  j5             !:
+    INTEGER(iwp) ::  k              !:
+    INTEGER(iwp) ::  k1             !:
+    INTEGER(iwp) ::  k2             !:
+    INTEGER(iwp) ::  k3             !:
+    INTEGER(iwp) ::  k5             !:
+    INTEGER(iwp) ::  n              !:
+    INTEGER(iwp) ::  nn             !:
+    INTEGER(iwp) ::  t_index        !:
+    INTEGER(iwp) ::  t_index_number !:
+    
+    LOGICAL  ::  reflect_x   !:
+    LOGICAL  ::  reflect_y   !:
+    LOGICAL  ::  reflect_z   !:
+
+    REAL(wp) ::  dt_particle !:
+    REAL(wp) ::  pos_x       !:
+    REAL(wp) ::  pos_x_old   !:
+    REAL(wp) ::  pos_y       !:
+    REAL(wp) ::  pos_y_old   !:
+    REAL(wp) ::  pos_z       !:
+    REAL(wp) ::  pos_z_old   !:
+    REAL(wp) ::  prt_x       !:
+    REAL(wp) ::  prt_y       !:
+    REAL(wp) ::  prt_z       !:
+    REAL(wp) ::  t(1:200)    !:
+    REAL(wp) ::  tmp_t       !:
+    REAL(wp) ::  xline       !:
+    REAL(wp) ::  yline       !:
+    REAL(wp) ::  zline       !:
 
     IF ( range == 'bottom/top' )  THEN
Index: /palm/trunk/SOURCE/lpm_calc_liquid_water_content.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_calc_liquid_water_content.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_calc_liquid_water_content.f90	(revision 1320)
@@ -20,12 +20,13 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
 ! -----------------
 ! $Id$
-!
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
 !
 ! 1036 2012-10-22 13:43:42Z raasch
@@ -41,16 +42,37 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE constants
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
-    USE particle_attributes
+    USE arrays_3d,                                                             &
+        ONLY:  ql, ql_v, ql_vp
+
+    USE cloud_parameters,                                                      &
+        ONLY:  rho_l
+
+    USE constants,                                                             &
+        ONLY:  pi
+
+    USE control_parameters,                                                    &
+        ONLY:  dz, message_string, rho_surface
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  particles, prt_count, prt_start_index
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, n, psi
+    INTEGER(iwp) ::  i   !:
+    INTEGER(iwp) ::  j   !:
+    INTEGER(iwp) ::  k   !:
+    INTEGER(iwp) ::  n   !:
+    INTEGER(iwp) ::  psi !:
 
 
Index: /palm/trunk/SOURCE/lpm_collision_kernels.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_collision_kernels.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_collision_kernels.f90	(revision 1320)
@@ -20,12 +20,14 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
 ! -----------------
 ! $Id$
-!
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
 !
 ! 1092 2013-02-02 11:24:22Z raasch
@@ -62,9 +64,4 @@
 ! routine renamed from wang_kernel to lpm_collision_kernels,
 ! turbulence_effects on collision replaced by wang_kernel
-!
-! 799 2011-12-21 17:48:03Z franke
-! speed optimizations and formatting
-! Bugfix: iq=1 is not allowed (routine effic) 
-! Bugfix: replaced stop by ec=0.0 in case of very small ec (routine effic) 
 !
 ! 790 2011-11-29 03:11:20Z raasch
@@ -86,8 +83,12 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE constants
-    USE particle_attributes
+    USE constants,                                                             &
+        ONLY:  pi
+        
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  collision_kernel, dissipation_classes, particles, radius_classes
+
     USE pegrid
 
@@ -100,9 +101,22 @@
             rclass_lbound, rclass_ubound, recalculate_kernel
 
-    REAL ::  epsilon, eps2, rclass_lbound, rclass_ubound, urms, urms2
-
-    REAL, DIMENSION(:),   ALLOCATABLE ::  epsclass, radclass, winf
-    REAL, DIMENSION(:,:), ALLOCATABLE ::  ec, ecf, gck, hkernel, hwratio
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  ckernel
+    REAL(wp) ::  epsilon       !:
+    REAL(wp) ::  eps2          !:
+    REAL(wp) ::  rclass_lbound !:
+    REAL(wp) ::  rclass_ubound !:
+    REAL(wp) ::  urms          !:
+    REAL(wp) ::  urms2         !:
+
+    REAL(wp), DIMENSION(:),   ALLOCATABLE ::  epsclass !:
+    REAL(wp), DIMENSION(:),   ALLOCATABLE ::  radclass !:
+    REAL(wp), DIMENSION(:),   ALLOCATABLE ::  winf     !:
+    
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ec       !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ecf      !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  gck      !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  hkernel  !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  hwratio  !:
+    
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  ckernel !:
 
     SAVE
@@ -134,5 +148,7 @@
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+       INTEGER(iwp) ::  k !:
 
 
@@ -262,14 +278,19 @@
     SUBROUTINE recalculate_kernel( i1, j1, k1 )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE constants
-       USE cpulog
-       USE indices
-       USE particle_attributes
+       USE arrays_3d,                                                          &
+           ONLY:  diss
+
+       USE particle_attributes,                                                &
+           ONLY:  prt_count, prt_start_index, radius_classes, wang_kernel
 
        IMPLICIT NONE
 
-       INTEGER ::  i, i1, j, j1, k1, pend, pstart
+       INTEGER(iwp) ::  i      !:
+       INTEGER(iwp) ::  i1     !:
+       INTEGER(iwp) ::  j      !:
+       INTEGER(iwp) ::  j1     !:
+       INTEGER(iwp) ::  k1     !:
+       INTEGER(iwp) ::  pend   !:
+       INTEGER(iwp) ::  pstart !:
 
 
@@ -340,24 +361,64 @@
     SUBROUTINE turbsd
 
-       USE constants
-       USE cloud_parameters
-       USE particle_attributes
-       USE arrays_3d
-       USE control_parameters
+       USE control_parameters,                                                 &
+           ONLY:  g, molecular_viscosity
+    
+       USE particle_attributes,                                                &
+           ONLY:  radius_classes
 
        IMPLICIT NONE
-
-       INTEGER ::  i, j
-
-       LOGICAL, SAVE ::  first = .TRUE.
-
-       REAL ::  ao, ao_gr, bbb, be, b1, b2, ccc, c1, c1_gr, c2, d1, d2, eta, &
-                e1, e2, fao_gr, fr, grfin, lambda, lambda_re, lf, rc, rrp,   &
-                sst, tauk, tl, t2, tt, t1, vk, vrms1xy, vrms2xy, v1, v1v2xy, &
-                v1xysq, v2, v2xysq, wrfin, wrgrav2, wrtur2xy, xx, yy, z
-
-       REAL, DIMENSION(1:radius_classes) ::  st, tau
-
-
+       
+       LOGICAL, SAVE ::  first = .TRUE. !:
+
+       INTEGER(iwp) ::  i     !:
+       INTEGER(iwp) ::  j     !:
+
+       REAL(wp) ::  ao        !:
+       REAL(wp) ::  ao_gr     !:
+       REAL(wp) ::  bbb       !:
+       REAL(wp) ::  be        !:
+       REAL(wp) ::  b1        !:
+       REAL(wp) ::  b2        !:
+       REAL(wp) ::  ccc       !:
+       REAL(wp) ::  c1        !:
+       REAL(wp) ::  c1_gr     !:
+       REAL(wp) ::  c2        !:
+       REAL(wp) ::  d1        !:
+       REAL(wp) ::  d2        !:
+       REAL(wp) ::  eta       !:
+       REAL(wp) ::  e1        !:
+       REAL(wp) ::  e2        !:
+       REAL(wp) ::  fao_gr    !:
+       REAL(wp) ::  fr        !:
+       REAL(wp) ::  grfin     !:
+       REAL(wp) ::  lambda    !:
+       REAL(wp) ::  lambda_re !:
+       REAL(wp) ::  lf        !:
+       REAL(wp) ::  rc        !:
+       REAL(wp) ::  rrp       !:
+       REAL(wp) ::  sst       !:
+       REAL(wp) ::  tauk      !:
+       REAL(wp) ::  tl        !:
+       REAL(wp) ::  t2        !:
+       REAL(wp) ::  tt        !:
+       REAL(wp) ::  t1        !:
+       REAL(wp) ::  vk        !:
+       REAL(wp) ::  vrms1xy   !:
+       REAL(wp) ::  vrms2xy   !:
+       REAL(wp) ::  v1        !:
+       REAL(wp) ::  v1v2xy    !:
+       REAL(wp) ::  v1xysq    !:
+       REAL(wp) ::  v2        !:
+       REAL(wp) ::  v2xysq    !:
+       REAL(wp) ::  wrfin     !:
+       REAL(wp) ::  wrgrav2   !:
+       REAL(wp) ::  wrtur2xy  !:
+       REAL(wp) ::  xx        !:
+       REAL(wp) ::  yy        !:
+       REAL(wp) ::  z         !:
+
+       REAL(wp), DIMENSION(1:radius_classes) ::  st  !:
+       REAL(wp), DIMENSION(1:radius_classes) ::  tau !:
+       
 !
 !--    Initial assignment of constants
@@ -478,9 +539,13 @@
 ! phi_w as a function
 !------------------------------------------------------------------------------!
-    REAL FUNCTION phi_w( a, b, vsett, tau0 )
+    REAL(wp) FUNCTION phi_w( a, b, vsett, tau0 )
 
        IMPLICIT NONE
 
-       REAL ::  a, aa1, b, tau0, vsett
+       REAL(wp) ::  a     !:
+       REAL(wp) ::  aa1   !:
+       REAL(wp) ::  b     !:
+       REAL(wp) ::  tau0  !:
+       REAL(wp) ::  vsett !:
 
        aa1 = 1.0 / tau0 + 1.0 / a + vsett / b
@@ -493,9 +558,20 @@
 ! zhi as a function
 !------------------------------------------------------------------------------!
-    REAL FUNCTION zhi( a, b, vsett1, tau1, vsett2, tau2 )
+    REAL(wp) FUNCTION zhi( a, b, vsett1, tau1, vsett2, tau2 )
 
        IMPLICIT NONE
 
-       REAL ::  a, aa1, aa2, aa3, aa4, aa5, aa6, b, tau1, tau2, vsett1, vsett2
+       REAL(wp) ::  a      !:
+       REAL(wp) ::  aa1    !:
+       REAL(wp) ::  aa2    !:
+       REAL(wp) ::  aa3    !:
+       REAL(wp) ::  aa4    !:
+       REAL(wp) ::  aa5    !:
+       REAL(wp) ::  aa6    !:
+       REAL(wp) ::  b      !:
+       REAL(wp) ::  tau1   !:
+       REAL(wp) ::  tau2   !:
+       REAL(wp) ::  vsett1 !:
+       REAL(wp) ::  vsett2 !:
 
        aa1 = vsett2 / b - 1.0 / tau2 - 1.0 / a
@@ -518,23 +594,39 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE fallg
-
-       USE constants
-       USE cloud_parameters
-       USE particle_attributes
-       USE arrays_3d
-       USE control_parameters
+ 
+       USE cloud_parameters,                                                   &
+           ONLY:  rho_l
+    
+       USE control_parameters,                                                 &
+           ONLY:  g
+
+       USE particle_attributes,                                                &
+           ONLY:  radius_classes
+
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j
-
-       LOGICAL, SAVE ::  first = .TRUE.
-
-       REAL, SAVE ::  cunh, eta, phy, py, rho_a, sigma, stb, stok, xlamb
-
-       REAL ::  bond, x, xrey, y
-
-       REAL, DIMENSION(1:7), SAVE  ::  b
-       REAL, DIMENSION(1:6), SAVE  ::  c
+       INTEGER(iwp) ::  i !:
+       INTEGER(iwp) ::  j !:
+
+       LOGICAL, SAVE ::  first = .TRUE. !:
+
+       REAL(wp), SAVE ::  cunh  !:
+       REAL(wp), SAVE ::  eta   !:
+       REAL(wp), SAVE ::  phy   !:
+       REAL(wp), SAVE ::  py    !:
+       REAL(wp), SAVE ::  rho_a !:
+       REAL(wp), SAVE ::  sigma !:
+       REAL(wp), SAVE ::  stb   !:
+       REAL(wp), SAVE ::  stok  !:
+       REAL(wp), SAVE ::  xlamb !:
+
+       REAL(wp) ::  bond        !:
+       REAL(wp) ::  x           !:
+       REAL(wp) ::  xrey        !:
+       REAL(wp) ::  y           !:
+
+       REAL(wp), DIMENSION(1:7), SAVE  ::  b !:
+       REAL(wp), DIMENSION(1:6), SAVE  ::  c !:
 
 !
@@ -617,23 +709,31 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE effic
-
-       USE arrays_3d
-       USE cloud_parameters
-       USE constants
-       USE particle_attributes
+ 
+       USE particle_attributes,                                                &
+           ONLY:  radius_classes
 
        IMPLICIT NONE
 
-       INTEGER ::  i, iq, ir, j, k
-
-       INTEGER, DIMENSION(:), ALLOCATABLE ::  ira
-
-       LOGICAL, SAVE ::  first = .TRUE.
-
-       REAL ::  ek, particle_radius, pp, qq, rq
-
-       REAL, DIMENSION(1:21), SAVE ::  rat
-       REAL, DIMENSION(1:15), SAVE ::  r0
-       REAL, DIMENSION(1:15,1:21), SAVE ::  ecoll
+       INTEGER(iwp) ::  i  !:
+       INTEGER(iwp) ::  iq !:
+       INTEGER(iwp) ::  ir !:
+       INTEGER(iwp) ::  j  !:
+       INTEGER(iwp) ::  k  !:
+
+       INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ira !:
+
+       LOGICAL, SAVE ::  first = .TRUE. !:
+
+       REAL(wp) ::  ek              !:
+       REAL(wp) ::  particle_radius !:
+       REAL(wp) ::  pp              !:
+       REAL(wp) ::  qq              !:
+       REAL(wp) ::  rq              !:
+
+       REAL(wp), DIMENSION(1:21), SAVE ::  rat        !:
+       
+       REAL(wp), DIMENSION(1:15), SAVE ::  r0         !:
+       
+       REAL(wp), DIMENSION(1:15,1:21), SAVE ::  ecoll !:
 
 !
@@ -754,22 +854,34 @@
     SUBROUTINE turb_enhance_eff
 
-       USE constants
-       USE cloud_parameters
-       USE particle_attributes
-       USE arrays_3d
+       USE particle_attributes,                                                &
+           ONLY:  radius_classes
 
        IMPLICIT NONE
 
-       INTEGER :: i, iq, ir, j, k, kk
-
-       INTEGER, DIMENSION(:), ALLOCATABLE ::  ira
-
-       REAL ::  particle_radius, pp, qq, rq, y1, y2, y3
-
-       LOGICAL, SAVE ::  first = .TRUE.
-
-       REAL, DIMENSION(1:11), SAVE ::  rat
-       REAL, DIMENSION(1:7), SAVE  ::  r0
-       REAL, DIMENSION(1:7,1:11), SAVE ::  ecoll_100, ecoll_400
+       INTEGER(iwp) :: i  !:
+       INTEGER(iwp) :: iq !:
+       INTEGER(iwp) :: ir !:
+       INTEGER(iwp) :: j  !:
+       INTEGER(iwp) :: k  !:
+       INTEGER(iwp) :: kk !:
+
+       INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ira !:
+       
+       LOGICAL, SAVE ::  first = .TRUE. !:
+
+       REAL(wp) ::  particle_radius !:
+       REAL(wp) ::  pp              !:
+       REAL(wp) ::  qq              !:
+       REAL(wp) ::  rq              !:
+       REAL(wp) ::  y1              !:
+       REAL(wp) ::  y2              !:
+       REAL(wp) ::  y3              !:
+
+       REAL(wp), DIMENSION(1:11), SAVE ::  rat           !:
+       
+       REAL(wp), DIMENSION(1:7), SAVE  ::  r0            !:
+       
+       REAL(wp), DIMENSION(1:7,1:11), SAVE ::  ecoll_100 !:
+       REAL(wp), DIMENSION(1:7,1:11), SAVE ::  ecoll_400 !:
 
 !
@@ -898,14 +1010,30 @@
        IMPLICIT NONE
 
-       INTEGER       ::  i, j, k
-
-       LOGICAL, SAVE ::  first = .TRUE.
-
-       REAL          ::  aa, bb, cc, dd, dx, dy, e, gg, mean_r, mean_rm, r, &
-                         rm, x, y
-
-       REAL, DIMENSION(1:9), SAVE      ::  collected_r = 0.0
-       REAL, DIMENSION(1:19), SAVE     ::  collector_r = 0.0
-       REAL, DIMENSION(1:9,1:19), SAVE ::  ef = 0.0
+       INTEGER(iwp)  ::  i !:
+       INTEGER(iwp)  ::  j !:
+       INTEGER(iwp)  ::  k !:
+
+       LOGICAL, SAVE ::  first = .TRUE. !:
+
+       REAL(wp)      ::  aa      !:
+       REAL(wp)      ::  bb      !:
+       REAL(wp)      ::  cc      !:
+       REAL(wp)      ::  dd      !:
+       REAL(wp)      ::  dx      !:
+       REAL(wp)      ::  dy      !:
+       REAL(wp)      ::  e       !:
+       REAL(wp)      ::  gg      !:
+       REAL(wp)      ::  mean_r  !:
+       REAL(wp)      ::  mean_rm !:
+       REAL(wp)      ::  r       !:
+       REAL(wp)      ::  rm      !:
+       REAL(wp)      ::  x       !:
+       REAL(wp)      ::  y       !:
+ 
+       REAL(wp), DIMENSION(1:9), SAVE      ::  collected_r = 0.0 !:
+       
+       REAL(wp), DIMENSION(1:19), SAVE     ::  collector_r = 0.0 !:
+       
+       REAL(wp), DIMENSION(1:9,1:19), SAVE ::  ef = 0.0          !:
 
        mean_rm = mean_r * 1.0E06
Index: /palm/trunk/SOURCE/lpm_data_output_particles.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_data_output_particles.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_data_output_particles.f90	(revision 1320)
@@ -20,13 +20,10 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! revision history before 2012 removed,
 !
 ! Former revisions:
 ! -----------------
 ! $Id$
-!
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
-!
 !
 ! 1036 2012-10-22 13:43:42Z raasch
@@ -43,8 +40,16 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE cpulog
+    USE control_parameters,                                                    &
+        ONLY:  netcdf_output, prt_time_count, simulated_time
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
     USE netcdf_control
-    USE particle_attributes
+
+    USE particle_attributes,                                                   &
+        ONLY:  maximum_number_of_particles, maximum_number_of_tailpoints,      &
+               maximum_number_of_tails, number_of_particles, number_of_tails,  &
+               particles, particle_tail_coordinates
 
     IMPLICIT NONE
@@ -64,5 +69,5 @@
                   number_of_tails
     IF ( maximum_number_of_tails > 0 )  THEN
-       WRITE ( 85 )  particle_tail_coordinates
+       WRITE ( 85 )  particle_tail_coordinates, prt_time_count
     ENDIF
 
Index: /palm/trunk/SOURCE/lpm_droplet_collision.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_droplet_collision.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_droplet_collision.f90	(revision 1320)
@@ -20,12 +20,14 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
 ! -----------------
 ! $Id$
-!
-! 1318 2014-03-17 13:35:16Z raasch
-! module interfaces removed
 !
 ! 1092 2013-02-02 11:24:22Z raasch
@@ -67,26 +69,90 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE constants
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
-    USE lpm_collision_kernels_mod
-    USE particle_attributes
+    USE arrays_3d,                                                             &
+        ONLY:  diss, ql, ql_v, ql_vp, u, v, w, zu, zw
+
+    USE cloud_parameters,                                                      &
+        ONLY:  effective_coll_efficiency
+
+    USE constants,                                                             &
+        ONLY:  pi
+
+    USE control_parameters,                                                    &
+        ONLY:  dt_3d, message_string, u_gtrans, v_gtrans, dz
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx, dx, ddy, dy
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt 
+
+    USE kinds
+
+    USE lpm_collision_kernels_mod,                                             &
+        ONLY:  ckernel, collision_efficiency_rogers, recalculate_kernel
+
+    USE particle_attributes,                                                   &
+        ONLY:  deleted_particles, dissipation_classes, hall_kernel,            &
+               palm_kernel, particles, particle_mask, particle_type,           &
+               prt_count, prt_start_index, use_kernel_tables, wang_kernel
 
     IMPLICIT NONE
 
-    INTEGER ::  eclass, i, ii, inc, is, j, jj, js, k, kk, n, pse, psi, rclass_l, &
-                rclass_s
-
-    REAL ::  aa, bb, cc, dd, delta_r, delta_v, gg, epsilon, mean_r, ql_int,    &
-             ql_int_l, ql_int_u, u_int, u_int_l, u_int_u, v_int, v_int_l,      &
-             v_int_u, w_int, w_int_l, w_int_u, sl_r3, sl_r4, x, y, sum1, sum2, &
-             sum3, r3, ddV
-
-    TYPE(particle_type) ::  tmp_particle
-    REAL, DIMENSION(:), ALLOCATABLE :: rad, weight
+    INTEGER(iwp) ::  eclass   !:
+    INTEGER(iwp) ::  i        !:
+    INTEGER(iwp) ::  ii       !:
+    INTEGER(iwp) ::  inc      !:
+    INTEGER(iwp) ::  is       !:
+    INTEGER(iwp) ::  j        !:
+    INTEGER(iwp) ::  jj       !:
+    INTEGER(iwp) ::  js       !:
+    INTEGER(iwp) ::  k        !:
+    INTEGER(iwp) ::  kk       !:
+    INTEGER(iwp) ::  n        !:
+    INTEGER(iwp) ::  pse      !:
+    INTEGER(iwp) ::  psi      !:
+    INTEGER(iwp) ::  rclass_l !:
+    INTEGER(iwp) ::  rclass_s !:
+
+    REAL(wp) ::  aa       !:
+    REAL(wp) ::  bb       !:
+    REAL(wp) ::  cc       !:
+    REAL(wp) ::  dd       !:
+    REAL(wp) ::  ddV      !:
+    REAL(wp) ::  delta_r  !:
+    REAL(wp) ::  delta_v  !:
+    REAL(wp) ::  epsilon  !:
+    REAL(wp) ::  gg       !:
+    REAL(wp) ::  mean_r   !:
+    REAL(wp) ::  ql_int   !:
+    REAL(wp) ::  ql_int_l !:
+    REAL(wp) ::  ql_int_u !:
+    REAL(wp) ::  r3       !:
+    REAL(wp) ::  sl_r3    !:
+    REAL(wp) ::  sl_r4    !:
+    REAL(wp) ::  sum1     !:
+    REAL(wp) ::  sum2     !:
+    REAL(wp) ::  sum3     !:
+    REAL(wp) ::  u_int    !:
+    REAL(wp) ::  u_int_l  !:
+    REAL(wp) ::  u_int_u  !:
+    REAL(wp) ::  v_int    !:
+    REAL(wp) ::  v_int_l  !:
+    REAL(wp) ::  v_int_u  !:
+    REAL(wp) ::  w_int    !:
+    REAL(wp) ::  w_int_l  !:
+    REAL(wp) ::  w_int_u  !:
+    REAL(wp) ::  x        !:
+    REAL(wp) ::  y        !:
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  rad    !:
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  weight !:
+
+
+    TYPE(particle_type) ::  tmp_particle           !:
+
 
 
Index: /palm/trunk/SOURCE/lpm_droplet_condensation.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_droplet_condensation.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_droplet_condensation.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -61,37 +65,113 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE constants
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE lpm_collision_kernels_mod
-    USE particle_attributes
+    USE arrays_3d,                                                             &
+        ONLY:  hyp, pt, q,  ql_c, ql_v, zu
+
+    USE cloud_parameters,                                                      &
+        ONLY:  bfactor, curvature_solution_effects, diff_coeff_l,              &
+               eps_ros, l_d_rv, l_v, rho_l,  r_v, thermal_conductivity_l
+
+    USE constants,                                                             &
+        ONLY:  pi
+
+    USE control_parameters,                                                    &
+        ONLY:  atmos_ocean_sign, dt_3d, dz, message_string,                    &
+               molecular_viscosity, rho_surface
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, ddx, dy, ddy
+
+    USE lpm_collision_kernels_mod,                                             &
+        ONLY:  rclass_lbound, rclass_ubound
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  hall_kernel, number_of_particles, offset_ocean_nzt,             &
+               offset_ocean_nzt_m1, particles, radius_classes,                 &
+               use_kernel_tables, wang_kernel
+
 
     IMPLICIT NONE
 
-    INTEGER ::  i, internal_timestep_count, j, jtry, k, n, ros_count
-
-    INTEGER, PARAMETER ::  maxtry = 40
-
-    LOGICAL ::  repeat
-
-    REAL ::  aa, afactor, arg, bb, cc, dd, ddenom, delta_r, drdt, drdt_ini,    &
-             dt_ros, dt_ros_next, dt_ros_sum, dt_ros_sum_ini, d2rdtdr, errmax, &
-             err_ros, g1, g2, g3, g4, e_a, e_s, gg, new_r, p_int, pt_int,      &
-             pt_int_l, pt_int_u, q_int, q_int_l, q_int_u, r_ros, r_ros_ini,    &
-             sigma, t_int, x, y, re_p
-
-!
+    INTEGER(iwp) :: i                          !:
+    INTEGER(iwp) :: internal_timestep_count    !:
+    INTEGER(iwp) :: j                          !:
+    INTEGER(iwp) :: jtry                       !:
+    INTEGER(iwp) :: k                          !:
+    INTEGER(iwp) :: n                          !:
+    INTEGER(iwp) :: ros_count                  !:
+ 
+    INTEGER(iwp), PARAMETER ::  maxtry = 40    !:
+
+    LOGICAL ::  repeat                         !:
+
+    REAL(wp) ::  aa                            !:
+    REAL(wp) ::  afactor                       !:
+    REAL(wp) ::  arg                           !:
+    REAL(wp) ::  bb                            !:
+    REAL(wp) ::  cc                            !:
+    REAL(wp) ::  dd                            !:
+    REAL(wp) ::  ddenom                        !:
+    REAL(wp) ::  delta_r                       !:
+    REAL(wp) ::  drdt                          !:
+    REAL(wp) ::  drdt_ini                      !:
+    REAL(wp) ::  dt_ros                        !:
+    REAL(wp) ::  dt_ros_next                   !:
+    REAL(wp) ::  dt_ros_sum                    !:
+    REAL(wp) ::  dt_ros_sum_ini                !:
+    REAL(wp) ::  d2rdtdr                       !:
+    REAL(wp) ::  errmax                        !:
+    REAL(wp) ::  err_ros                       !:
+    REAL(wp) ::  g1                            !:
+    REAL(wp) ::  g2                            !:
+    REAL(wp) ::  g3                            !:
+    REAL(wp) ::  g4                            !:
+    REAL(wp) ::  e_a                           !:
+    REAL(wp) ::  e_s                           !:
+    REAL(wp) ::  gg                            !:
+    REAL(wp) ::  new_r                         !:
+    REAL(wp) ::  p_int                         !:
+    REAL(wp) ::  pt_int                        !:
+    REAL(wp) ::  pt_int_l                      !:
+    REAL(wp) ::  pt_int_u                      !:
+    REAL(wp) ::  q_int                         !:
+    REAL(wp) ::  q_int_l                       !:
+    REAL(wp) ::  q_int_u                       !:
+    REAL(wp) ::  r_ros                         !:
+    REAL(wp) ::  r_ros_ini                     !:
+    REAL(wp) ::  sigma                         !:
+    REAL(wp) ::  t_int                         !:
+    REAL(wp) ::  x                             !:
+    REAL(wp) ::  y                             !: 
+    REAL(wp) ::  re_p                          !:
+ 
 !-- Parameters for Rosenbrock method
-    REAL, PARAMETER ::  a21 = 2.0, a31 = 48.0/25.0, a32 = 6.0/25.0,        &
-                        b1 = 19.0/9.0, b2 = 0.5, b3 = 25.0/108.0,          &
-                        b4 = 125.0/108.0, c21 = -8.0, c31 = 372.0/25.0,    &
-                        c32 = 12.0/5.0, c41 = -112.0/125.0,                &
-                        c42 = -54.0/125.0, c43 = -2.0/5.0,                 &
-                        errcon = 0.1296, e1 = 17.0/54.0, e2 = 7.0/36.0,    &
-                        e3 = 0.0, e4 = 125.0/108.0, gam = 0.5, grow = 1.5, &
-                        pgrow = -0.25, pshrnk = -1.0/3.0, shrnk = 0.5
+    REAL(wp), PARAMETER ::  a21 = 2.0          !:
+    REAL(wp), PARAMETER ::  a31 = 48.0/25.0    !:
+    REAL(wp), PARAMETER ::  a32 = 6.0/25.0     !:
+    REAL(wp), PARAMETER ::  b1 = 19.0/9.0      !:
+    REAL(wp), PARAMETER ::  b2 = 0.5           !:
+    REAL(wp), PARAMETER ::  b3 = 25.0/108.0    !:
+    REAL(wp), PARAMETER ::  b4 = 125.0/108.0   !:
+    REAL(wp), PARAMETER ::  c21 = -8.0         !:
+    REAL(wp), PARAMETER ::  c31 = 372.0/25.0   !:
+    REAL(wp), PARAMETER ::  c32 = 12.0/5.0     !:
+    REAL(wp), PARAMETER ::  c41 = -112.0/125.0 !:
+    REAL(wp), PARAMETER ::  c42 = -54.0/125.0  !:
+    REAL(wp), PARAMETER ::  c43 = -2.0/5.0     !:
+    REAL(wp), PARAMETER ::  errcon = 0.1296    !:
+    REAL(wp), PARAMETER ::  e1 = 17.0/54.0     !:
+    REAL(wp), PARAMETER ::  e2 = 7.0/36.0      !:
+    REAL(wp), PARAMETER ::  e3 = 0.0           !:
+    REAL(wp), PARAMETER ::  e4 = 125.0/108.0   !:
+    REAL(wp), PARAMETER ::  gam = 0.5          !:
+    REAL(wp), PARAMETER ::  grow = 1.5         !:
+    REAL(wp), PARAMETER ::  pgrow = -0.25      !:
+    REAL(wp), PARAMETER ::  pshrnk = -1.0/3.0  !:
+    REAL(wp), PARAMETER ::  shrnk = 0.5        !:
+
 
 
Index: /palm/trunk/SOURCE/lpm_exchange_horiz.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_exchange_horiz.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_exchange_horiz.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -45,23 +49,64 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
-    USE particle_attributes
+    USE control_parameters,                                                    &
+        ONLY:  message_string, netcdf_output, netcdf_data_format
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx, ddy, dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nx, nxl, nxr, ny, nyn, nys
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  deleted_particles, deleted_tails, ibc_par_lr, ibc_par_ns,       &
+               maximum_number_of_particles, maximum_number_of_tails,           &
+               maximum_number_of_tailpoints, mpi_particle_type,                &
+               number_of_tails, number_of_particles, particles, particle_mask, &
+               particle_tail_coordinates, particle_type, tail_mask,            &
+               trlp_count_sum, trlp_count_recv_sum, trnp_count_sum,            &
+               trnp_count_recv_sum, trrp_count_sum, trrp_count_recv_sum,       &
+               trsp_count_sum, trsp_count_recv_sum, use_particle_tails
+
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, n, nn, tlength, &
-                trlp_count, trlp_count_recv, trlpt_count, trlpt_count_recv, &
-                trnp_count, trnp_count_recv, trnpt_count, trnpt_count_recv, &
-                trrp_count, trrp_count_recv, trrpt_count, trrpt_count_recv, &
-                trsp_count, trsp_count_recv, trspt_count, trspt_count_recv
-
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  trlpt, trnpt, trrpt, trspt
-
-    TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  trlp, trnp, trrp, trsp
-
+    INTEGER(iwp) ::  i                                       !:
+    INTEGER(iwp) ::  j                                       !:
+    INTEGER(iwp) ::  n                                       !:
+    INTEGER(iwp) ::  nn                                      !:
+    INTEGER(iwp) ::  tlength                                 !:
+    INTEGER(iwp) ::  trlp_count                              !:
+    INTEGER(iwp) ::  trlp_count_recv                         !:
+    INTEGER(iwp) ::  trlpt_count                             !:
+    INTEGER(iwp) ::  trlpt_count_recv                        !:
+    INTEGER(iwp) ::  trnp_count                              !:
+    INTEGER(iwp) ::  trnp_count_recv                         !:
+    INTEGER(iwp) ::  trnpt_count                             !:
+    INTEGER(iwp) ::  trnpt_count_recv                        !:
+    INTEGER(iwp) ::  trrp_count                              !:
+    INTEGER(iwp) ::  trrp_count_recv                         !:
+    INTEGER(iwp) ::  trrpt_count                             !:
+    INTEGER(iwp) ::  trrpt_count_recv                        !:
+    INTEGER(iwp) ::  trsp_count                              !:
+    INTEGER(iwp) ::  trsp_count_recv                         !:
+    INTEGER(iwp) ::  trspt_count                             !:
+    INTEGER(iwp) ::  trspt_count_recv                        !:
+
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  trlpt        !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  trnpt        !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  trrpt        !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  trspt        !:
+
+
+    TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  trlp  !:
+    TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  trnp  !:
+    TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  trrp  !:
+    TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  trsp  !:
 
 #if defined( __parallel )
Index: /palm/trunk/SOURCE/lpm_extend_particle_array.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_extend_particle_array.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_extend_particle_array.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -38,13 +42,20 @@
 !------------------------------------------------------------------------------!
 
-    USE particle_attributes
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  number_of_initial_particles, number_of_particles,               &
+               maximum_number_of_particles, particles, particle_mask,          &
+               particle_type, write_particle_statistics
 
     IMPLICIT NONE
 
-    INTEGER ::  new_maximum_number, number_of_new_particles
+    INTEGER(iwp) ::  new_maximum_number                              !:
+    INTEGER(iwp) ::  number_of_new_particles                         !:
 
-    LOGICAL, DIMENSION(:), ALLOCATABLE ::  tmp_particle_mask
 
-    TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  tmp_particles
+    LOGICAL, DIMENSION(:), ALLOCATABLE ::  tmp_particle_mask         !:
+
+    TYPE(particle_type), DIMENSION(:), ALLOCATABLE ::  tmp_particles !:
 
 
Index: /palm/trunk/SOURCE/lpm_extend_tail_array.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_extend_tail_array.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_extend_tail_array.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -38,14 +42,20 @@
 !------------------------------------------------------------------------------!
 
-    USE particle_attributes
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  maximum_number_of_tails, maximum_number_of_tailpoints,          &
+               new_tail_id, number_of_initial_tails, number_of_tails,          &
+               particle_tail_coordinates, tail_mask, write_particle_statistics
 
     IMPLICIT NONE
 
-    INTEGER ::  new_maximum_number, number_of_new_tails
+    INTEGER(iwp) ::  new_maximum_number                           !:
+    INTEGER(iwp) ::  number_of_new_tails                          !:
 
-    LOGICAL, DIMENSION(maximum_number_of_tails) ::  tmp_tail_mask
+    LOGICAL, DIMENSION(maximum_number_of_tails) ::  tmp_tail_mask !:
 
-    REAL, DIMENSION(maximum_number_of_tailpoints,5,maximum_number_of_tails) :: &
-                                                    tmp_tail
+    REAL(wp), DIMENSION(maximum_number_of_tailpoints,5,maximum_number_of_tails) :: &
+                                                    tmp_tail      !:
 
 
Index: /palm/trunk/SOURCE/lpm_extend_tails.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_extend_tails.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_extend_tails.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -38,12 +42,21 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE particle_attributes
+    USE control_parameters,                                                    &
+        ONLY:  dt_3d
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  maximum_number_of_tailpoints, maximum_tailpoint_age,            &
+               minimum_tailpoint_distance, number_of_particles, particles,     &
+               particle_tail_coordinates
 
     IMPLICIT NONE
 
-    INTEGER ::  i, n, nn
+    INTEGER(iwp) ::  i       !:
+    INTEGER(iwp) ::  n       !:
+    INTEGER(iwp) ::  nn      !:
 
-    REAL ::  distance
+    REAL(wp) ::  distance    !:
 
 
Index: /palm/trunk/SOURCE/lpm_init.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_init.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_init.f90	(revision 1320)
@@ -20,4 +20,11 @@
 ! Current revisions:
 ! -----------------
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
+! bugfix: #if defined( __parallel ) added
 !
 ! Former revisions:
@@ -52,41 +59,4 @@
 ! of arrays.
 !
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 336 2009-06-10 11:19:35Z raasch
-! Maximum number of tails is calculated from maximum number of particles and
-! skip_particles_for_tail,
-! output of messages replaced by message handling routine
-! Bugfix: arrays for tails are allocated with a minimum size of 10 tails if
-! there is no tail initially
-!
-! 150 2008-02-29 08:19:58Z raasch
-! Setting offset_ocean_* needed for calculating vertical indices within ocean
-! runs
-!
-! 117 2007-10-11 03:27:59Z raasch
-! Sorting of particles only in case of cloud droplets
-!
-! 106 2007-08-16 14:30:26Z raasch
-! variable iran replaced by iran_part
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Preprocessor directives for old systems removed
-!
-! 70 2007-03-18 23:46:30Z raasch
-! displacements for mpi_particle_type changed, age_m initialized,
-! particles-package is now part of the default code
-!
-! 16 2007-02-15 13:16:47Z raasch
-! Bugfix: MPI_REAL in MPI_ALLREDUCE replaced by MPI_INTEGER
-!
-! r4 | raasch | 2007-02-13 12:33:16 +0100 (Tue, 13 Feb 2007)
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.24  2007/02/11 13:00:17  raasch
-! Bugfix: allocation of tail_mask and new_tail_id in case of restart-runs
-! Bugfix: __ was missing in a cpp-directive
-!
 ! Revision 1.1  1999/11/25 16:22:38  raasch
 ! Initial revision
@@ -99,25 +69,80 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE control_parameters
-    USE dvrp_variables
-    USE grid_variables
-    USE indices
-    USE lpm_collision_kernels_mod
-    USE particle_attributes
+    USE arrays_3d,                                                             &
+        ONLY:  de_dx, de_dy, de_dz, zu, zw, z0
+
+    USE cloud_parameters,                                                      &
+        ONLY:  curvature_solution_effects
+
+    USE control_parameters,                                                    &
+        ONLY:  cloud_droplets, current_timestep_number, initializing_actions,  &
+               message_string, netcdf_output,netcdf_data_format, ocean,        &
+               prandtl_layer, simulated_time
+
+    USE dvrp_variables,                                                        &
+        ONLY:  particle_color, particle_dvrpsize
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nx, nxl, nxlg, nxrg, nxr, ny, nyn, nys, nyng, nysg, nz, nzb, nzt
+
+    USE kinds
+
+    USE lpm_collision_kernels_mod,                                             &
+        ONLY:  init_kernels
+
+    USE particle_attributes,                                                   &
+        ONLY:   bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, collision_kernel,    &
+                density_ratio, dvrp_psize, initial_weighting_factor, ibc_par_b,&
+                ibc_par_lr, ibc_par_ns, ibc_par_t, initial_particles,          &
+                iran_part, log_z_z0, max_number_of_particle_groups,            &
+                maximum_number_of_particles, maximum_number_of_tailpoints,     &
+                minimum_tailpoint_distance, maximum_number_of_tails,           &
+                mpi_particle_type, new_tail_id, number_of_initial_particles,   &
+                number_of_initial_tails, number_of_particles,                  &
+                number_of_particle_groups, number_of_sublayers,                &
+                number_of_tails, offset_ocean_nzt, offset_ocean_nzt_m1, part_1,&
+                part_2, particles, particle_advection_start, particle_groups,  &
+                particle_groups_type, particle_mask, particles_per_point,      &
+                particle_tail_coordinates,  particle_type, pdx, pdy, pdz,      &
+                prt_count, prt_start_index, psb, psl, psn, psr, pss, pst,      &
+                radius, random_start_position, read_particles_from_restartfile,&
+                skip_particles_for_tail, sort_count, tail_mask,                &
+                total_number_of_particles, total_number_of_tails,              &
+                use_particle_tails, use_sgs_for_particles,                     &
+                write_particle_statistics, uniform_particles, z0_av_global
+
     USE pegrid
-    USE random_function_mod
+
+    USE random_function_mod,                                                   &
+        ONLY:  random_function
 
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, n, nn
+    INTEGER(iwp) ::  i                           !:
+    INTEGER(iwp) ::  j                           !:
+    INTEGER(iwp) ::  k                           !:
+    INTEGER(iwp) ::  n                           !:
+    INTEGER(iwp) ::  nn                          !:
+
 #if defined( __parallel )
-    INTEGER, DIMENSION(3) ::  blocklengths, displacements, types
+    INTEGER(iwp), DIMENSION(3) ::  blocklengths  !:
+    INTEGER(iwp), DIMENSION(3) ::  displacements !:
+    INTEGER(iwp), DIMENSION(3) ::  types         !:
 #endif
-    LOGICAL ::  uniform_particles_l
-    REAL    ::  height_int, height_p, pos_x, pos_y, pos_z, z_p,            &
-                z0_av_local = 0.0
+    LOGICAL ::  uniform_particles_l              !:
+
+    REAL(wp)    ::  height_int                   !:
+    REAL(wp)    ::  height_p                     !:
+    REAL(wp)    ::  pos_x                        !:
+    REAL(wp)    ::  pos_y                        !:
+    REAL(wp)    ::  pos_z                        !:
+    REAL(wp)    ::  z_p                          !:
+    REAL(wp)    ::  z0_av_local = 0.0            !:
+
+                
 
 
@@ -211,6 +236,10 @@
        z0_av_global = 0.0
 
+#if defined( __parallel )
        CALL MPI_ALLREDUCE(z0_av_local, z0_av_global, 1, MPI_REAL, MPI_SUM, &
                           comm2d, ierr )
+#else
+       z0_av_global = z0_av_local
+#endif
 
        z0_av_global = z0_av_global  / ( ( ny + 1 ) * ( nx + 1 ) )
Index: /palm/trunk/SOURCE/lpm_init_sgs_tke.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_init_sgs_tke.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_init_sgs_tke.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -41,15 +45,29 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
-    USE particle_attributes
+    USE arrays_3d,                                                             &
+        ONLY:  de_dx, de_dy, de_dz, diss, e, u, v, w, zu
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx, ddy
+
+    USE indices,                                                               &
+        ONLY:  nbgp, ngp_2dh_outer, nx, nxl, nxr, ny, nyn, nys, nz, nzb,       &
+                      nzb_s_inner, nzb_s_outer, nzt
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  sgs_wfu_part, sgs_wfv_part, sgs_wfw_part
+
     USE pegrid
-    USE statistics
+
+    USE statistics,                                                            &
+        ONLY:  flow_statistics_called, hom, sums, sums_l
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k
+    INTEGER(iwp) ::  i      !:
+    INTEGER(iwp) ::  j      !:
+    INTEGER(iwp) ::  k      !:
 
 
Index: /palm/trunk/SOURCE/lpm_pack_arrays.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_pack_arrays.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_pack_arrays.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -40,11 +44,17 @@
 !------------------------------------------------------------------------------!
 
-    USE particle_attributes
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  deleted_particles, deleted_tails, new_tail_id,                  &
+               number_of_particles, number_of_tails, particles, particle_mask, &
+               particle_tail_coordinates, tail_mask, use_particle_tails
+
 
     IMPLICIT NONE
 
-    INTEGER ::  n, nd, nn
-
-
+    INTEGER(iwp) ::  n       !:
+    INTEGER(iwp) ::  nd      !:
+    INTEGER(iwp) ::  nn      !:
 !
 !-- Find out elements marked for deletion and move data with higher index
Index: /palm/trunk/SOURCE/lpm_read_restart_file.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_read_restart_file.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_read_restart_file.f90	(revision 1320)
@@ -20,5 +20,7 @@
 ! Current revisions:
 ! ------------------
-! 
+! ONLY-attribute added to USE-statements,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -38,12 +40,27 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE indices
-    USE particle_attributes
+    USE control_parameters,                                                    &
+        ONLY:  message_string
+
+    USE indices,                                                               &
+        ONLY:  nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nz, nzb, nzt
+
+    USE particle_attributes,                                                   &
+        ONLY:  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, initial_particles,    &
+               number_of_initial_particles, maximum_number_of_particles,       &
+               maximum_number_of_tailpoints, maximum_number_of_tails,          &
+               new_tail_id, number_of_particles, number_of_particle_groups,    &
+               number_of_tails, particles, particle_groups, particle_mask,     &
+               particle_tail_coordinates, particle_type, part_1, part_2,       &
+               prt_count, prt_start_index,  sort_count, tail_mask, time_prel,  &
+               time_write_particle_data, uniform_particles, use_particle_tails
+
+
     USE pegrid
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=10) ::  particle_binary_version, version_on_file
+    CHARACTER (LEN=10) ::  particle_binary_version    !:
+    CHARACTER (LEN=10) ::  version_on_file            !:
 
 !
Index: /palm/trunk/SOURCE/lpm_release_set.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_release_set.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_release_set.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -40,13 +44,32 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE grid_variables
-    USE indices
-    USE particle_attributes
-    USE random_function_mod
+    USE control_parameters,                                                    &
+        ONLY:  iran, message_string, netcdf_data_format, netcdf_output
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nyn, nys
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  initial_particles, iran_part, maximum_number_of_particles,      &
+               maximum_number_of_tails, minimum_tailpoint_distance,            &
+               number_of_initial_particles, number_of_initial_tails,           &
+               number_of_particles, number_of_tails, particles,                &
+               particle_tail_coordinates, pdx, pdy, pdz, psb, psl, psn, psr,   &
+               pss, pst, random_start_position, use_particle_tails
+
+    USE random_function_mod,                                                   &
+        ONLY:  random_function
 
     IMPLICIT NONE
 
-    INTEGER ::  ie, is, n, nn
+    INTEGER(iwp) ::  ie     !:
+    INTEGER(iwp) ::  is     !:
+    INTEGER(iwp) ::  n      !:
+    INTEGER(iwp) ::  nn     !:
 
 
Index: /palm/trunk/SOURCE/lpm_set_attributes.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_set_attributes.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_set_attributes.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -37,7 +42,4 @@
 ! 828 2012-02-21 12:00:36Z raasch
 ! particle feature color renamed class
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
 !
 ! 271 2009-03-26 00:47:14Z raasch
@@ -50,21 +52,61 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE dvrp_variables
-    USE grid_variables
-    USE indices
-    USE particle_attributes
+    USE arrays_3d,                                                             &
+        ONLY:  pt, u, v, w, zu, zw
+
+    USE control_parameters,                                                    &
+        ONLY:  atmos_ocean_sign, u_gtrans, v_gtrans, dz
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE dvrp_variables,                                                        &
+        ONLY:  color_interval, dvrp_colortable_entries_prt, dvrpsize_interval, &
+               particle_color, particle_dvrpsize
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx, dx, ddy, dy
+
+    USE indices,                                                               &
+        ONLY:  ngp_2dh, nxl, nxr, nyn, nys, nzb, nzt
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  number_of_particles, offset_ocean_nzt, particles
+
     USE pegrid
-    USE statistics
+
+    USE statistics,                                                            &
+        ONLY:  sums, sums_l
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, n
-    REAL    ::  aa, absuv, bb, cc, dd, gg, height, pt_int, pt_int_l, pt_int_u, &
-                u_int, u_int_l, u_int_u, v_int, v_int_l, v_int_u, w_int,       &
-                w_int_l, w_int_u, x, y
-
+    INTEGER(iwp) ::  i        !:
+    INTEGER(iwp) ::  j        !:
+    INTEGER(iwp) ::  k        !:
+    INTEGER(iwp) ::  n        !:
+
+    REAL(wp)    ::  aa        !:
+    REAL(wp)    ::  absuv     !:
+    REAL(wp)    ::  bb        !:
+    REAL(wp)    ::  cc        !:
+    REAL(wp)    ::  dd        !:
+    REAL(wp)    ::  gg        !:
+    REAL(wp)    ::  height    !:
+    REAL(wp)    ::  pt_int    !:
+    REAL(wp)    ::  pt_int_l  !:
+    REAL(wp)    ::  pt_int_u  !:
+    REAL(wp)    ::  u_int     !:
+    REAL(wp)    ::  u_int_l   !:
+    REAL(wp)    ::  u_int_u   !:
+    REAL(wp)    ::  v_int     !:
+    REAL(wp)    ::  v_int_l   !:
+    REAL(wp)    ::  v_int_u   !:
+    REAL(wp)    ::  w_int     !:
+    REAL(wp)    ::  w_int_l   !:
+    REAL(wp)    ::  w_int_u   !:
+    REAL(wp)    ::  x         !:
+    REAL(wp)    ::  y         !:
 
     CALL cpu_log( log_point_s(49), 'lpm_set_attributes', 'start' )
Index: /palm/trunk/SOURCE/lpm_sort_arrays.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_sort_arrays.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_sort_arrays.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -41,16 +45,31 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
-    USE particle_attributes
+    USE control_parameters,                                                     &
+        ONLY:  message_string, dz
+
+    USE cpulog,                                                                 &
+        ONLY:  cpu_log, log_point_s
+
+    USE grid_variables,                                                         &
+        ONLY:  ddx, dx, ddy, dy
+
+    USE indices,                                                                &
+        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
+
+    USE kinds
+
+    USE particle_attributes,                                                    &
+        ONLY:  number_of_particles, offset_ocean_nzt, part_1, part_2, particles,&
+               particle_type, prt_count, prt_start_index, sort_count
 
     IMPLICIT NONE
 
-    INTEGER ::  i, ilow, j, k, n
+    INTEGER(iwp) ::  i                                            !:
+    INTEGER(iwp) ::  ilow                                         !:
+    INTEGER(iwp) ::  j                                            !:
+    INTEGER(iwp) ::  k                                            !:
+    INTEGER(iwp) ::  n                                            !:
 
-    TYPE(particle_type), DIMENSION(:), POINTER ::  particles_temp
+    TYPE(particle_type), DIMENSION(:), POINTER ::  particles_temp !:
 
 
Index: /palm/trunk/SOURCE/lpm_write_exchange_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_write_exchange_statistics.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_write_exchange_statistics.f90	(revision 1320)
@@ -20,5 +20,7 @@
 ! Current revisions:
 ! ------------------
-! 
+! ONLY-attribute added to USE-statements,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -42,6 +44,13 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE particle_attributes
+    USE control_parameters,                                                     &
+        ONLY:  current_timestep_number, dt_3d, simulated_time
+
+    USE particle_attributes,                                                    &
+        ONLY:  maximum_number_of_particles, number_of_particles, trlp_count_sum,&
+               trlp_count_recv_sum, trnp_count_sum, trnp_count_recv_sum,        &
+               trrp_count_sum, trrp_count_recv_sum, trsp_count_sum,             &
+               trsp_count_recv_sum
+
     USE pegrid
 
Index: /palm/trunk/SOURCE/lpm_write_restart_file.f90
===================================================================
--- /palm/trunk/SOURCE/lpm_write_restart_file.f90	(revision 1319)
+++ /palm/trunk/SOURCE/lpm_write_restart_file.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -38,12 +42,24 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE particle_attributes
+    USE control_parameters,                                                    &
+        ONLY:  io_blocks, io_group
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, initial_particles,    &
+        maximum_number_of_particles,  maximum_number_of_tails,                 &
+        maximum_number_of_tailpoints, number_of_initial_particles,             &
+        number_of_particles, number_of_particle_groups, number_of_tails,       &
+        particles, particle_groups, particle_tail_coordinates, prt_count,      &
+        prt_start_index, time_prel, time_write_particle_data,                  &
+        uniform_particles, use_particle_tails
+
     USE pegrid
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=10) ::  particle_binary_version
-    INTEGER ::  i
+    CHARACTER (LEN=10) ::  particle_binary_version   !:
+    INTEGER(iwp) ::  i                               !:
 
 !
Index: /palm/trunk/SOURCE/ls_forcing.f90
===================================================================
--- /palm/trunk/SOURCE/ls_forcing.f90	(revision 1319)
+++ /palm/trunk/SOURCE/ls_forcing.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -59,18 +63,37 @@
     SUBROUTINE init_ls_forcing
 
-       USE arrays_3d
-       USE control_parameters
-       USE cpulog
-       USE indices
-       USE pegrid
+       USE arrays_3d,                                                          &
+           ONLY:  p_surf, pt_surf, q_surf, qsws_surf, shf_surf, time_surf,     &
+                  time_vert, ug_vert, vg_vert, wsubs_vert, zu
+
+       USE control_parameters,                                                 &
+           ONLY:  end_time, lsf_surf, lsf_vert, message_string, nlsf
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzt
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       INTEGER ::  finput = 90, ierrn, k, t 
-       CHARACTER (100)::  chmess
-       CHARACTER(1) ::  hash
-       REAL ::  r_dummy, fac
-       REAL ::  highheight, highug_vert, highvg_vert, highwsubs_vert
-       REAL ::  lowheight, lowug_vert, lowvg_vert, lowwsubs_vert
+       CHARACTER(100) ::  chmess              !:
+       CHARACTER(1)   ::  hash                !:
+
+       INTEGER(iwp) ::  ierrn                 !:
+       INTEGER(iwp) ::  finput = 90           !:
+       INTEGER(iwp) ::  k                     !:
+       INTEGER(iwp) ::  t                     !:
+
+       REAL(wp) ::  fac                       !:
+       REAL(wp) ::  highheight                !:
+       REAL(wp) ::  highug_vert               !:
+       REAL(wp) ::  highvg_vert               !:
+       REAL(wp) ::  highwsubs_vert            !:
+       REAL(wp) ::  lowheight                 !:
+       REAL(wp) ::  lowug_vert                !:
+       REAL(wp) ::  lowvg_vert                !:
+       REAL(wp) ::  lowwsubs_vert             !:
+       REAL(wp) ::  r_dummy                   !:
 
        ALLOCATE( p_surf(0:nlsf), pt_surf(0:nlsf), q_surf(0:nlsf),         &
@@ -226,15 +249,21 @@
     SUBROUTINE ls_forcing_surf ( time )
 
-       USE arrays_3d
-       USE control_parameters
-       USE cpulog
-       USE indices
-       USE pegrid
+       USE arrays_3d,                                                          &
+           ONLY:  p_surf, pt_surf, q_surf, qsws, qsws_surf, shf, shf_surf,     &
+                  time_surf, time_vert, ug, ug_vert, vg, vg_vert
+
+       USE control_parameters,                                                 &
+           ONLY:  bc_q_b, ibc_pt_b, ibc_q_b, pt_surface, q_surface,            &
+                  surface_pressure
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       REAL, INTENT(in)  :: time
-       REAL :: fac
-       INTEGER :: t
+       INTEGER(iwp) ::  t                     !:
+
+       REAL(wp)             :: fac            !:
+       REAL(wp), INTENT(in) :: time           !:
 
 !
@@ -284,15 +313,19 @@
     SUBROUTINE ls_forcing_vert ( time )
 
-       USE arrays_3d
-       USE control_parameters
-       USE cpulog
-       USE indices
-       USE pegrid
+       USE arrays_3d,                                                          &
+           ONLY:  time_vert, ug, ug_vert, vg, vg_vert, w_subs, wsubs_vert
+
+       USE control_parameters,                                                 &
+           ONLY:  large_scale_subsidence
+
+       USE kinds
+
 
        IMPLICIT NONE
 
-       REAL, INTENT(in)  :: time
-       REAL :: fac
-       INTEGER :: t
+       INTEGER(iwp) ::  t                     !:
+
+       REAL(wp)             ::  fac           !:
+       REAL(wp), INTENT(in) ::  time          !:
 
 !
Index: /palm/trunk/SOURCE/message.f90
===================================================================
--- /palm/trunk/SOURCE/message.f90	(revision 1319)
+++ /palm/trunk/SOURCE/message.f90	(revision 1320)
@@ -21,5 +21,9 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -29,10 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 746 2011-08-18 21:14:48Z letzel
-! 'wiki' inserted into weblink path to error message database
-! 
-! 563 2010-09-30 13:08:44Z raasch
-! Weblink to error message database changed to new trac server
 !
 ! 213 2008-11-13 10:26:18Z raasch
@@ -50,16 +48,28 @@
 !------------------------------------------------------------------------------!
 
+    USE control_parameters,                                                  &
+        ONLY:  abort_mode, message_string
+
+    USE kinds
+
     USE pegrid
-    USE control_parameters
 
     IMPLICIT NONE
 
-    CHARACTER(LEN=6)   ::  message_identifier
-    CHARACTER(LEN=*)   ::  routine_name
-    CHARACTER(LEN=200) ::  header_string, information_string_1,information_string_2
-
-    INTEGER ::  file_id, flush, i, message_level, output_on_pe, requested_action
-
-    LOGICAL ::  do_output, pe_out_of_range
+    CHARACTER(LEN=6)   ::  message_identifier            !:
+    CHARACTER(LEN=*)   ::  routine_name                  !:
+    CHARACTER(LEN=200) ::  header_string                 !:
+    CHARACTER(LEN=200) ::  information_string_1          !:
+    CHARACTER(LEN=200) ::  information_string_2          !:
+
+    INTEGER(iwp) ::  file_id                             !:
+    INTEGER(iwp) ::  flush                               !:
+    INTEGER(iwp) ::  i                                   !:
+    INTEGER(iwp) ::  message_level                       !:
+    INTEGER(iwp) ::  output_on_pe                        !:
+    INTEGER(iwp) ::  requested_action                    !:
+
+    LOGICAL ::  do_output                                !:
+    LOGICAL ::  pe_out_of_range                          !:
 
 
Index: /palm/trunk/SOURCE/microphysics.f90
===================================================================
--- /palm/trunk/SOURCE/microphysics.f90	(revision 1319)
+++ /palm/trunk/SOURCE/microphysics.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -111,10 +115,12 @@
        USE grid_variables
        USE indices
+       USE kinds
        USE statistics
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
  
        DO  i = nxl, nxr
@@ -133,8 +139,11 @@
        USE cloud_parameters
        USE indices
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
 
  
@@ -157,10 +166,12 @@
        USE grid_variables
        USE indices
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k
-
- 
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
+
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -180,10 +191,12 @@
        USE control_parameters
        USE indices
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k
-
- 
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
+
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -203,8 +216,11 @@
        USE control_parameters
        USE indices
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
 
  
@@ -227,9 +243,11 @@
        USE control_parameters
        USE indices
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k
-
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
  
        DO  i = nxl, nxr
@@ -251,9 +269,11 @@
        USE control_parameters
        USE indices
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k
-
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
  
        DO  i = nxl, nxr
@@ -275,10 +295,12 @@
        USE control_parameters
        USE indices
+       USE kinds
        USE statistics
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
  
        DO  i = nxl, nxr
@@ -299,15 +321,31 @@
     SUBROUTINE microphysics_control_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k 
-       REAL    ::  t_surface
+       USE arrays_3d,                                                          &
+           ONLY:  hyp, nc_1d,  nr, nr_1d, pt, pt_init, pt_1d, q, q_1d, qc,     &
+                  qc_1d, qr, qr_1d, tend_nr, tend_pt, tend_q, tend_qr, zu
+
+       USE cloud_parameters,                                                   &
+           ONLY:  cp, hyrho, nc_const, pt_d_t, r_d, t_d_pt
+
+       USE control_parameters,                                                 &
+           ONLY:  drizzle, dt_3d, dt_micro, g, intermediate_timestep_count,    &
+                  large_scale_forcing, lsf_surf, precipitation, pt_surface,    &
+                  rho_surface,surface_pressure
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzt
+
+       USE kinds
+
+       USE statistics,                                                         &
+           ONLY:  weight_pres
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
+
+       REAL(wp)     ::  t_surface         !:
 
        IF ( large_scale_forcing .AND. lsf_surf ) THEN
@@ -369,11 +407,20 @@
     SUBROUTINE adjust_cloud_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE indices
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k
+       USE arrays_3d,                                                          &
+           ONLY:  qr, nr
+
+       USE cloud_parameters,                                                   &
+           ONLY:  eps_sb, xrmin, xrmax, hyrho, k_cc, x0
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_s_inner, nzt
+
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
 !
 !--    Adjust number of raindrops to avoid nonlinear effects in 
@@ -407,16 +454,42 @@
     SUBROUTINE autoconversion_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE grid_variables
-       USE indices
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k
-       REAL    ::  alpha_cc, autocon, epsilon, k_au, l_mix, nu_c, phi_au,      &
-                   r_cc, rc, re_lambda, selfcoll, sigma_cc, tau_cloud, xc                      
-
+       USE arrays_3d,                                                          &
+           ONLY:  diss, dzu, nc_1d, nr_1d, qc_1d, qr_1d
+
+       USE cloud_parameters,                                                   &
+           ONLY:  a_1, a_2, a_3, b_1, b_2, b_3, beta_cc, c_1, c_2, c_3,        &
+                  c_const, dpirho_l, eps_sb, hyrho, k_cc, kin_vis_air, x0
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_micro, rho_surface, turbulence
+
+       USE grid_variables,                                                     &
+           ONLY:  dx, dy
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_s_inner, nzt
+
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
+
+       REAL(wp)     ::  alpha_cc          !:                   
+       REAL(wp)     ::  autocon           !:
+       REAL(wp)     ::  epsilon           !:
+       REAL(wp)     ::  k_au              !:
+       REAL(wp)     ::  l_mix             !:
+       REAL(wp)     ::  nu_c              !:
+       REAL(wp)     ::  phi_au            !:
+       REAL(wp)     ::  r_cc              !:
+       REAL(wp)     ::  rc                !:
+       REAL(wp)     ::  re_lambda         !:
+       REAL(wp)     ::  selfcoll          !:
+       REAL(wp)     ::  sigma_cc          !:
+       REAL(wp)     ::  tau_cloud         !:
+       REAL(wp)     ::  xc                !:
 
        k_au = k_cc / ( 20.0 * x0 )
@@ -491,13 +564,29 @@
     SUBROUTINE accretion_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE indices
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k
-       REAL    ::  accr, k_cr, phi_ac, tau_cloud, xc
+       USE arrays_3d,                                                          &
+           ONLY:  diss, qc_1d, qr_1d
+
+       USE cloud_parameters,                                                   &
+           ONLY:  eps_sb, hyrho, k_cr0
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_micro, rho_surface, turbulence
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_s_inner, nzt
+
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
+
+       REAL(wp)     ::  accr              !:
+       REAL(wp)     ::  k_cr              !:
+       REAL(wp)     ::  phi_ac            !:
+       REAL(wp)     ::  tau_cloud         !:
+       REAL(wp)     ::  xc                !:
 
        DO  k = nzb_s_inner(j,i)+1, nzt
@@ -539,13 +628,28 @@
     SUBROUTINE selfcollection_breakup_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  nr_1d, qr_1d
+
+       USE cloud_parameters,                                                   &
+           ONLY:  dpirho_l, eps_sb, hyrho, k_br, k_rr
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_micro, rho_surface
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_s_inner, nzt
+
+       USE kinds
    
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  breakup, dr, phi_br, selfcoll
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
+
+       REAL(wp)     ::  breakup           !:
+       REAL(wp)     ::  dr                !:
+       REAL(wp)     ::  phi_br            !:
+       REAL(wp)     ::  selfcoll          !:
 
        DO  k = nzb_s_inner(j,i)+1, nzt
@@ -581,15 +685,47 @@
 !--    precipitable water.
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE constants
-       USE control_parameters
-       USE indices
-
-       IMPLICIT NONE
-
-       INTEGER ::  i, j, k
-       REAL    ::  alpha, dr, e_s, evap, evap_nr, f_vent, g_evap, lambda_r, &
-                   mu_r, mu_r_2, mu_r_5d2, nr_0, q_s, sat, t_l, temp, xr
+       USE arrays_3d,                                                          &
+           ONLY:  hyp, nr_1d, pt_1d, q_1d,  qc_1d, qr_1d
+
+       USE cloud_parameters,                                                   &
+           ONLY:  a_term, a_vent, b_term, b_vent, c_evap, c_term, diff_coeff_l,&
+                  dpirho_l, eps_sb, hyrho, kin_vis_air, k_st, l_d_cp, l_d_r,   &
+                  l_v, rho_l, r_v, schmidt_p_1d3, thermal_conductivity_l,      &
+                  t_d_pt, ventilation_effect
+
+       USE constants,                                                          &
+           ONLY:  pi
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_micro
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_s_inner, nzt
+
+       USE kinds
+
+       IMPLICIT NONE
+
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
+
+       REAL(wp)     ::  alpha             !:
+       REAL(wp)     ::  dr                !:
+       REAL(wp)     ::  e_s               !:
+       REAL(wp)     ::  evap              !:
+       REAL(wp)     ::  evap_nr           !:
+       REAL(wp)     ::  f_vent            !:
+       REAL(wp)     ::  g_evap            !:
+       REAL(wp)     ::  lambda_r          !:
+       REAL(wp)     ::  mu_r              !:
+       REAL(wp)     ::  mu_r_2            !:
+       REAL(wp)     ::  mu_r_5d2          !:
+       REAL(wp)     ::  nr_0              !:
+       REAL(wp)     ::  q_s               !:
+       REAL(wp)     ::  sat               !:
+       REAL(wp)     ::  t_l               !:
+       REAL(wp)     ::  temp              !:
+       REAL(wp)     ::  xr                !:
 
        DO  k = nzb_s_inner(j,i)+1, nzt
@@ -680,16 +816,31 @@
     SUBROUTINE sedimentation_cloud_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE constants
-       USE control_parameters
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, dzu, nc_1d, pt_1d, q_1d, qc_1d
+
+       USE cloud_parameters,                                                   &
+           ONLY:  eps_sb, hyrho, k_st, l_d_cp, prr, pt_d_t, rho_l, sigma_gc
+
+       USE constants,                                                          &
+           ONLY:  pi
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_do2d_xy, dt_micro, intermediate_timestep_count
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_s_inner, nzt
+
+       USE kinds
        
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-       REAL    ::  sed_qc_const
-
-       REAL, DIMENSION(nzb:nzt+1) :: sed_qc
+       INTEGER(iwp) ::  i                 !:
+       INTEGER(iwp) ::  j                 !:
+       INTEGER(iwp) ::  k                 !:
+
+       REAL(wp)     ::  sed_qc_const      !:
+
+
+       REAL(wp), DIMENSION(nzb:nzt+1) :: sed_qc
 
 !
@@ -725,19 +876,55 @@
     SUBROUTINE sedimentation_rain_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE constants
-       USE control_parameters
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, dzu, nr_1d, pt_1d, q_1d, qr_1d
+
+       USE cloud_parameters,                                                   &
+           ONLY:  a_term, b_term, c_term, cof, dpirho_l, eps_sb, hyrho,        &
+                  limiter_sedimentation, l_d_cp, precipitation_amount, prr,    &
+                  pt_d_t, stp
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_do2d_xy, dt_micro, dt_3d, intermediate_timestep_count,    &
+                  intermediate_timestep_count_max,                             &
+                  precipitation_amount_interval, time_do2d_xy
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzb_s_inner, nzt
+
+       USE kinds
+
+       USE statistics,                                                         &
+           ONLY:  weight_substep
        
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, k_run
-       REAL    ::  c_run, d_max, d_mean, d_min, dr, dt_sedi, flux, lambda_r,  &
-                   mu_r, z_run
-
-       REAL, DIMENSION(nzb:nzt+1) :: c_nr, c_qr, d_nr, d_qr, nr_slope,        &
-                                     qr_slope, sed_nr, sed_qr, w_nr, w_qr 
+       INTEGER(iwp) ::  i                          !:
+       INTEGER(iwp) ::  j                          !:
+       INTEGER(iwp) ::  k                          !:
+       INTEGER(iwp) ::  k_run                      !:
+
+       REAL(wp)     ::  c_run                      !:
+       REAL(wp)     ::  d_max                      !:
+       REAL(wp)     ::  d_mean                     !:
+       REAL(wp)     ::  d_min                      !:
+       REAL(wp)     ::  dr                         !:
+       REAL(wp)     ::  dt_sedi                    !:
+       REAL(wp)     ::  flux                       !:
+       REAL(wp)     ::  lambda_r                   !:
+       REAL(wp)     ::  mu_r                       !:
+       REAL(wp)     ::  z_run                      !:
+
+      REAL(wp), DIMENSION(nzb:nzt+1) ::  c_nr      !:
+      REAL(wp), DIMENSION(nzb:nzt+1) ::  c_qr      !:
+      REAL(wp), DIMENSION(nzb:nzt+1) ::  d_nr      !:
+      REAL(wp), DIMENSION(nzb:nzt+1) ::  d_qr      !:
+      REAL(wp), DIMENSION(nzb:nzt+1) ::  nr_slope  !:
+      REAL(wp), DIMENSION(nzb:nzt+1) ::  qr_slope  !:
+      REAL(wp), DIMENSION(nzb:nzt+1) ::  sed_nr    !:
+      REAL(wp), DIMENSION(nzb:nzt+1) ::  sed_qr    !:
+      REAL(wp), DIMENSION(nzb:nzt+1) ::  w_nr      !:
+      REAL(wp), DIMENSION(nzb:nzt+1) ::  w_qr      !:
+
+
 !
 !--    Computation of sedimentation flux. Implementation according to Stevens
@@ -896,12 +1083,20 @@
     FUNCTION gamm( xx ) 
        
-       USE cloud_parameters
-    
+       USE cloud_parameters,                                                   &
+           ONLY:  cof, stp
+
+       USE kinds
+
        IMPLICIT NONE 
- 
-       REAL    ::  gamm, ser, tmp, x_gamm, xx, y_gamm
-       INTEGER ::  j 
-
- 
+
+       INTEGER(iwp) ::  j            !:
+
+       REAL(wp)     ::  gamm         !:
+       REAL(wp)     ::  ser          !:
+       REAL(wp)     ::  tmp          !:
+       REAL(wp)     ::  x_gamm       !:
+       REAL(wp)     ::  xx           !:
+       REAL(wp)     ::  y_gamm       !:
+
        x_gamm = xx 
        y_gamm = x_gamm 
Index: /palm/trunk/SOURCE/mod_kinds.f90
===================================================================
--- /palm/trunk/SOURCE/mod_kinds.f90	(revision 1319)
+++ /palm/trunk/SOURCE/mod_kinds.f90	(revision 1320)
@@ -26,7 +26,4 @@
 ! $Id$
 !
-! 1318 2014-03-17 13:35:16Z raasch
-! bugfix: default integer kind changed to single precision
-!
 ! 1306 2014-03-13 14:30:59Z raasch
 ! Initial revision
@@ -46,16 +43,16 @@
 !
 !-- Floating point kinds
-    INTEGER, PARAMETER ::  sp = 4           ! single precision (32 bit)
-    INTEGER, PARAMETER ::  dp = 8           ! double precision (64 bit)
+    INTEGER, PARAMETER ::  sp = 4           !: single precision (32 bit)
+    INTEGER, PARAMETER ::  dp = 8           !: double precision (64 bit)
 
 !
 !-- Integer kinds
-    INTEGER, PARAMETER ::  isp = SELECTED_INT_KIND(  9 )   ! single precision (32 bit)
-    INTEGER, PARAMETER ::  idp = SELECTED_INT_KIND( 14 )   ! double precision (64 bit)
+    INTEGER, PARAMETER ::  isp = SELECTED_INT_KIND(  9 )   !: single precision (32 bit)
+    INTEGER, PARAMETER ::  idp = SELECTED_INT_KIND( 14 )   !: double precision (64 bit)
 
 !
 !-- Set kinds to be used as defaults
-    INTEGER, PARAMETER ::   wp =  dp          ! default real kind
-    INTEGER, PARAMETER ::  iwp = isp          ! default integer kind
+    INTEGER, PARAMETER ::   wp =  dp          !: default real kind
+    INTEGER, PARAMETER ::  iwp = isp          !: default integer kind
 
     SAVE
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 1319)
+++ /palm/trunk/SOURCE/modules.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -210,196 +216,4 @@
 ! for thread-safe summation in advec_ws.
 !
-! 792 2011-12-01 01:23:23Z raasch
-! particle arrays (particles, parrticles_temp) implemented as pointers,
-! +particles_1, particles_2, sort_count
-!
-! 790 2011-11-29 03:11:20Z raasch
-! +turbulence_effects_on_collision, wang_collision_kernel
-!
-! 785 2011-11-28 09:47:19Z raasch
-! +scalar_rayleigh_damping, rdf_sc
-!
-! 778 2011-11-07 14:18:25Z fricke
-! +gathered_size, subdomain_size
-!
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt_av
-!
-! 767 2011-10-14 06:39:12Z raasch
-! +u_profile, v_profile, uv_heights, use_prescribed_profile_data
-!
-! 759 2011-09-15 13:58:31Z raasch
-! +io_blocks, io_group, maximum_parallel_io_streams,
-! synchronous_exchange moved to control_parameters
-!
-! 743 2011-08-18 16:10:16Z suehring
-! Dimension of sums_wsus_ws_l, sums_wsvs_ws_l, sums_us2_ws_l, sums_vs2_ws_l, 
-! sums_ws2_ws_l, sums_wspts_ws_l, sums_wssas_ws_l,sums_wsqs_ws_l needed for 
-! statistical evaluation of turbulent fluxes in WS-scheme decreased.
-! 736 2011-08-17 14:13:26Z suehring
-! Dimension of fluxes needed for WS-scheme increased. 
-!
-! 722 2011-04-11 06:21:09Z raasch
-! Bugfix: default value for south_border_pe changed to .F.
-!
-! 707 2011-03-29 11:39:40Z raasch
-! +bc_lr_dirrad, bc_lr_raddir, bc_ns_dirrad, bc_ns_raddir, left_border_pe,
-! north_border_pe, right_border_pe, south_border_pe
-! p_sub renamed p_loc
-!
-! 683 2011-02-09 14:25:15Z raasch
-! +synchronous_exchange
-!
-! 673 2011-01-18 16:19:48Z suehring
-! +weight_pres to weight the respective contribution of the Runge-Kutta 
-! substeps. +p_sub to buffer the intermediate contributions for Multigrid and 
-! SOR.
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Removed u_nzb_p1_for_vfc and v_nzb_p1_for_vfc
-! For coupling with different resolution in ocean and atmophere:
-! +nx_a, +nx_o, ny_a, +ny_o, ngp_a, ngp_o, +total_2d_o, +total_2d_a,
-! +coupling_topology 
-! Buffer arrays for the left sided advective fluxes added in arrays_3d.
-! +flux_s_u, +flux_s_v, +flux_s_w, +diss_s_u, +diss_s_v, +diss_s_w,
-! +flux_s_pt, +diss_s_pt, +flux_s_e, +diss_s_e, +flux_s_q, +diss_s_q,
-! +flux_s_sa, +diss_s_sa
-! 3d arrays for dissipation control added. (only necessary for vector arch.)
-! +var_x, +var_y, +var_z, +gamma_x, +gamma_y, +gamma_z
-! Default of momentum_advec and scalar_advec changed to 'ws-scheme' .
-! +exchange_mg added in control_parameters to steer the data exchange.
-! Parameters +nbgp, +nxlg, +nxrg, +nysg, +nyng added in indices.
-! flag array +boundary_flags added in indices to steer the degradation of order 
-! of the advective fluxes when non-cyclic boundaries are used.
-! MPI-datatypes +type_y, +type_y_int and +type_yz for data_exchange added in 
-! pegrid.
-! +sums_wsus_ws_l, +sums_wsvs_ws_l, +sums_us2_ws_l, +sums_vs2_ws_l, 
-! +sums_ws2_ws_l, +sums_wspts_ws_l, +sums_wssas_ws_l, +sums_wsqs_ws_l 
-! and +weight_substep added in statistics to steer the statistical evaluation 
-! of turbulent fluxes in the advection routines.
-! LOGICALS +ws_scheme_sca and +ws_scheme_mom added to get a better performance
-! in prognostic_equations.
-! LOGICAL +dissipation_control control added to steer numerical dissipation
-! in ws-scheme.
-! Changed length of string run_description_header
-!
-! 622 2010-12-10 08:08:13Z raasch
-! +collective_wait in pegrid
-!
-! 600 2010-11-24 16:10:51Z raasch
-! default values of surface_scalarflux and surface_waterflux changed
-! to 9999999.9
-!
-! 580 2010-10-05 13:59:11Z heinze
-! Renaming of ws_vertical_gradient to subs_vertical_gradient,
-! ws_vertical_gradient_level to subs_vertical_gradient_level and
-! ws_vertical_gradient_level_ind to subs_vertical_gradient_level_i
-!
-! 564 2010-09-30 13:18:59Z helmke
-! nc_precision and netcdf_precision dimension changed to 11, all default 
-! values of mask_xyz_loop changed to -1.0, dimension of openfile changed to 
-! 200+2*max_masks, max_masks changed to 50
-!
-! 553 2010-09-01 14:09:06Z weinreis
-! parameters for masked output are replaced by arrays
-!
-! 531 2010-04-21 06:47:21Z heinze
-! character length of dopr_unit enlarged
-!
-! 519 2010-03-19 05:30:02Z raasch
-! -replace_char, replace_by
-!
-! 493 2010-03-01 08:30:24Z raasch
-! +netcdf_data_format, -netcdf_64bit, -netcdf_64bit_3d, -netcdf_format_mask*,
-! -nc_format_mask, -format_parallel_io
-!
-! 485 2010-02-05 10:57:51Z raasch
-! ngp_3d, ngp_3d_inner changed to 64 bit
-!
-! 449 2010-02-02 11:23:59Z raasch
-! -var_ts: replaced by dots_max,
-! initial data assignments to some dvrp arrays changed due to error messages
-! from gfortran compiler
-! +large_scale_subsidence, ws_vertical_gradient, ws_vertical_gradient_level,
-! ws_vertical_gradient_level_ind, w_subs
-!
-! 388 2009-09-23 09:40:33Z raasch
-! +prho, prho_1
-! +bc_lr_cyc, bc_ns_cyc
-! +output_for_t0 
-! translation error of actual -> current revisions fixed
-! +q* in dots_label, dots_unit. increased dots_num respectively
-! typographical error in dots_unit fixed
-! +clip_dvrp_*, cluster_size, color_interval, dvrpsize_interval, dvrp_overlap,
-! dvrp_total_overlap, groundplate_color, local_dvrserver_running, n*_dvrp,
-! interval_*_dvrp_prt, isosurface_color, particle_color, particle_dvrpsize,
-! topography color in dvrp_variables,
-! vertical_particle_advection is a 1d-array,
-! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
-! canyon_wall_south, conserve_volume_flow_mode, coupling_start_time,
-! dp_external, dp_level_b, dp_level_ind_b, dp_smooth, dp_smooth_factor, dpdxy,
-! run_coupled, time_since_reference_point, u_bulk, v_bulk in control_parameters,
-! default value of grid_matching changed to strict
-! +shf_av, qsws_av
-!
-! 217 2008-12-09 18:00:48Z letzel
-! +topography_grid_convention
-! some dvrp-variables changed to single precision, variables for dvrp-mode
-! pathlines added, +target_id, abort_mode, message_string
-!
-! 197 2008-09-16 15:29:03Z raasch
-! allow 100 spectra levels instead of 10 for consistency with 
-! define_netcdf_header, +canopy_heat_flux, cthf, lai,
-! +leaf_surface_concentration, scalar_exchange_coefficient, sec, sls
-! +hor_index_bounds, hor_index_bounds_previous_run, id_inflow, id_recycling,
-! inflow_damping_*, mean_inflow_profiles, numprocs_previous_run, nx_on_file,
-! ny_on_file, offset_ocean_*, recycling_plane, recycling_width, turbulent_inflow
-! -myid_char_14
-!
-! 138 2007-11-28 10:03:58Z letzel
-! +drag_coefficient, pch_index, lad_surface, lad_vertical_gradient, 
-! lad_vertical_gradient_level, plant_canopy, lad, lad_s, lad_u, lad_v, 
-! lad_w, cdc, lad_vertical_gradient_level_ind, canopy_mode
-! +dt_sort_particles, ngp_2dh_s_inner, time_sort_particles, flags, 
-! wall_flags_1..10, wall_humidityflux(0:4), wall_qflux(0:4), 
-! wall_salinityflux(0:4), wall_scalarflux(0:4)
-!
-! 108 2007-08-24 15:10:38Z letzel
-! +comm_inter, constant_top_momentumflux, coupling_char, coupling_mode,
-! coupling_mode_remote, c_u, c_v, c_w, dt_coupling, e_init, humidity_remote, 
-! ngp_xy, nxlu, nysv, port_name, qswst_remote, terminate_coupled, 
-! terminate_coupled_remote, time_coupling, top_momentumflux_u|v, type_xy, 
-! uswst*, vswst*
-!
-! 97 2007-06-21 08:23:15Z raasch
-! +atmos_ocean_sign, ocean, r, + salinity variables
-! defaults of .._vertical_gradient_levels changed from -1.0 to -9999999.9
-! hydro_press renamed hyp, use_pt_reference renamed use_reference
-!
-! 89 2007-05-25 12:08:31Z raasch
-! +data_output_pr_user, max_pr_user, size of data_output_pr, dopr_index,
-! dopr_initial_index and dopr_unit enlarged,
-! var_hom and var_sum renamed pr_palm
-!
-! 82 2007-04-16 15:40:52Z raasch
-! +return_addres, return_username
-! Cpp-directive lcmuk renamed lc
-!
-! 75 2007-03-22 09:54:05Z raasch
-! +arrays precipitation_amount, precipitation_rate, precipitation_rate_av,
-! rif_wall, z0_av, +arrays u_m_l, u_m_r, etc. for radiation boundary conditions,
-! +loop_optimization, netcdf_64bit_3d, zu_s_inner, zw_w_inner, id_var_zusi_*,
-! id_var_zwwi_*, ts_value, u_nzb_p1_for_vfc, v_nzb_p1_for_vfc, pt_reference,
-! use_pt_reference, precipitation_amount_interval, revision
-! +age_m in particle_type, moisture renamed humidity,
-! -data_output_ts, dots_n, uvmean_outflow, uxrp, vynp,
-! arrays dots_label and dots_unit now dimensioned with dots_max,
-! setting of palm version moved to main program
-!
-! 37 2007-03-01 08:33:54Z raasch
-! +constant_top_heatflux, top_heatflux, use_top_fluxes, +arrays for top fluxes,
-! +nzt_diff, default of bc_pt_t renamed "initial_gradient"
-! Bugfix: p is not a pointer
-!
 ! RCS Log replace by Id keyword, revision history cleaned up
 !
@@ -415,6 +229,7 @@
 ! Definition of variables for special advection schemes
 !------------------------------------------------------------------------------!
-
-    REAL, DIMENSION(:), ALLOCATABLE   ::  aex, bex, dex, eex
+    USE kinds
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE   ::  aex, bex, dex, eex
 
     SAVE
@@ -425,23 +240,4 @@
 
 
- MODULE precision_kind
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-! Definition of type parameters (used for the definition of single or double
-! precision variables)
-!------------------------------------------------------------------------------!
-
-    INTEGER, PARAMETER ::  dpk = SELECTED_REAL_KIND( 12 ), &
-                           spk = SELECTED_REAL_KIND( 6 )
-
-    SAVE
-
- END MODULE precision_kind
-
-
-
-
  MODULE arrays_3d
 
@@ -452,7 +248,7 @@
 !------------------------------------------------------------------------------!
 
-    USE precision_kind
-
-    REAL, DIMENSION(:), ALLOCATABLE ::                                         &
+    USE kinds
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::                                     &
           c_u_m, c_u_m_l, c_v_m, c_v_m_l, c_w_m, c_w_m_l, ddzu, ddzu_pres,     &
           dd2zu, dzu, ddzw, dzw, hyp, inflow_damping_factor, lad, l_grid,      &
@@ -462,5 +258,5 @@
           u_init, u_nzb_p1_for_vfc, vg, v_init, v_nzb_p1_for_vfc, w_subs, zu, zw
 
-    REAL, DIMENSION(:,:), ALLOCATABLE ::                                       &
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::                                   &
           c_u, c_v, c_w, diss_s_e, diss_s_nr, diss_s_pt, diss_s_q,             &
           diss_s_qr, diss_s_sa, diss_s_u, diss_s_v, diss_s_w, dzu_mg, dzw_mg,  &
@@ -473,5 +269,5 @@
           wnudge, wsubs_vert, z0, z0h
 
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::                                     &
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::                                 &
           canopy_heat_flux, cdc, d, de_dx, de_dy, de_dz, diss, diss_l_e,       &
           diss_l_nr, diss_l_pt, diss_l_q, diss_l_qr, diss_l_sa, diss_l_u,      &
@@ -483,15 +279,15 @@
 
 #if defined( __nopointer )
-    REAL, DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                             &
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
           e, e_p, nr, nr_p, p, prho, pt, pt_p, q, q_p, qc, ql, ql_c, ql_v,     &
           ql_vp, qr, qr_p, rho, sa, sa_p, te_m, tnr_m, tpt_m, tq_m, tqr_m,     &
           tsa_m, tu_m, tv_m, tw_m, u, u_p, v, v_p, vpt, w, w_p
 #else
-    REAL, DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                             &
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
           e_1, e_2, e_3, p, prho_1, nr_1, nr_2, nr_3, pt_1, pt_2, pt_3, q_1,   &
           q_2, q_3, qc_1, ql_v, ql_vp, ql_1, ql_2, qr_1, qr_2, qr_3, rho_1,    &
           sa_1, sa_2, sa_3, u_1, u_2, u_3, v_1, v_2, v_3, vpt_1, w_1, w_2, w_3
 
-    REAL, DIMENSION(:,:,:), POINTER ::                                         &
+    REAL(wp), DIMENSION(:,:,:), POINTER ::                                     &
           e, e_p, nr, nr_p, prho, pt, pt_p, q, q_p, qc, ql, ql_c, qr, qr_p,    &
           rho, sa, sa_p, te_m, tnr_m, tpt_m, tq_m, tqr_m, tsa_m, tu_m, tv_m,   &
@@ -499,7 +295,7 @@
 #endif
 
-    REAL, DIMENSION(:,:,:,:), ALLOCATABLE ::  rif_wall, tri
-
-    REAL, DIMENSION(:,:,:), ALLOCATABLE :: var_x, var_y, var_z, gamma_x,       &
+    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  rif_wall, tri
+
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: var_x, var_y, var_z, gamma_x,   &
                                            gamma_y, gamma_z
 
@@ -519,10 +315,11 @@
 ! Definition of variables needed for time-averaging of 2d/3d data
 !------------------------------------------------------------------------------!
-
-    REAL, DIMENSION(:,:), ALLOCATABLE ::  lwp_av, precipitation_rate_av,       &
+    USE kinds
+
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  lwp_av, precipitation_rate_av,   &
                                           qsws_av, shf_av,ts_av, us_av, z0_av, &
                                           z0h_av
 
-    REAL, DIMENSION(:,:,:), ALLOCATABLE, TARGET :: &
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
           e_av, lpt_av, nr_av, p_av, pc_av, pr_av, prr_av, pt_av, q_av, qc_av, &
           ql_av, ql_c_av, ql_v_av, ql_vp_av, qr_av, qv_av, rho_av, s_av, sa_av,&
@@ -540,4 +337,5 @@
 ! Definition of variables and constants for cloud physics
 !------------------------------------------------------------------------------!
+    USE kinds
 
     LOGICAL ::  curvature_solution_effects = .FALSE., &
@@ -546,72 +344,72 @@
                 
 
-    REAL ::  a_1 = 8.69E-4,     & ! coef. in turb. parametrization (cm-2 s3)
-             a_2 = -7.38E-5,    & ! coef. in turb. parametrization (cm-2 s3)
-             a_3 = -1.40E-2,    & ! coef. in turb. parametrization
-             a_term = 9.65,     & ! coef. for terminal velocity (m s-1)
-             a_vent = 0.78,     & ! coef. for ventilation effect
-             b_1 = 11.45E-6,    & ! coef. in turb. parametrization (m)
-             b_2 = 9.68E-6,     & ! coef. in turb. parametrization (m)
-             b_3 = 0.62,        & ! coef. in turb. parametrization
-             b_term = 9.8,      & ! coef. for terminal velocity (m s-1)
-             b_vent = 0.308,    & ! coef. for ventilation effect
-             beta_cc = 3.09E-4, & ! coef. in turb. parametrization (cm-2 s3)
-             bfactor,           &
-             c_1 = 4.82E-6,     & ! coef. in turb. parametrization (m)
-             c_2 = 4.8E-6,      & ! coef. in turb. parametrization (m)
-             c_3 = 0.76,        & ! coef. in turb. parametrization
-             c_const = 0.93,    & ! const. in Taylor-microscale Reynolds number
-             c_evap = 0.7,      & ! constant in evaporation
-             c_sedimentation = 2.0, & ! Courant number of sedimentation process
-             c_term = 600.0,    & ! coef. for terminal velocity (m-1)
-             cof(6) = (/ 76.18009172947146,      & ! coefficients in the 
-                         -86.50532032941677,     & ! numerical
-                         24.01409824083091,      & ! calculation of the
-                         -1.231739572450155,     & ! gamma function
-                         0.1208650973866179E-2,  &
-                         -0.5395239384953E-5 /), &
-             cp = 1005.0,       & ! heat capacity of dry air (J kg-1 K-1) 
-             diff_coeff_l = 0.23E-4, & ! diffusivity of water vapor (m2 s-1)
-             effective_coll_efficiency, &
-             eps_ros = 1.0E-4,  & ! accuracy of Rosenbrock method
-             eps_sb = 1.0E-20,  & ! threshold in two-moments scheme
-             k_cc = 9.44E09,    & ! const. cloud-cloud kernel (m3 kg-2 s-1) 
-             k_cr0 = 4.33,      & ! const. cloud-rain kernel (m3 kg-1 s-1) 
-             k_rr = 7.12,       & ! const. rain-rain kernel (m3 kg-1 s-1) 
-             k_br = 1000.,      & ! const. in breakup parametrization (m-1)
-             k_st = 1.2E8,      & ! const. in drizzle parametrization (m-1 s-1)
-             kappa_rr = 60.7,   & ! const. in collision kernel (kg-1/3)
-             kin_vis_air = 1.4086E-5, & ! kin. viscosity of air (m2 s-1)
-             l_v = 2.5E+06,     & ! latent heat of vaporization (J kg-1)
-             l_d_cp, l_d_r, l_d_rv, & ! l_v / cp, l_v / r_d, l_v / r_v
-             mass_of_solute = 1.0E-17, & ! soluted NaCl (kg)
-             molecular_weight_of_solute = 0.05844, & ! mol. m. NaCl (kg mol-1)
-             molecular_weight_of_water = 0.01801528, & ! mol. m. H2O (kg mol-1)
-             nc_const = 70.0E6, & ! cloud droplet concentration
-             prec_time_const = 0.001, & !coef. in Kessler scheme
-             pirho_l, dpirho_l, & ! pi * rho_l / 6.0; 6.0 / ( pi * rho_l )
-             rho_l = 1.0E3,     & ! density of water (kg m-3)
-             ql_crit = 0.0005,  & ! coef. in Kessler scheme
-             r_d = 287.0,       & ! sp. gas const. dry air (J kg-1 K-1)
-             r_v = 461.51,      & ! sp. gas const. water vapor (J kg-1 K-1)
-             schmidt = 0.71,    & ! Schmidt number
-             schmidt_p_1d3,     & ! schmidt**( 1.0 / 3.0 )
-             sigma_gc = 1.3,    & ! log-normal geometric standard deviation
-             stp = 2.5066282746310005, & ! parameter in gamma function
-             thermal_conductivity_l = 2.43E-2, & ! therm. cond. air (J m-1 s-1 K-1)
-             vanthoff = 2.0,    & ! van't Hoff factor for NaCl
-             x0 = 2.6E-10,      & ! separating drop mass (kg)
-             xrmin = 2.6E-10,   & ! minimum rain drop size (kg)
-             xrmax = 5.0E-6,    & ! maximum rain drop site (kg)
-             dt_precipitation = 100.0, & ! timestep precipitation (s)
-             w_precipitation = 9.65      ! maximum terminal velocity (m s-1)
-
-    REAL, DIMENSION(:), ALLOCATABLE     ::  hyrho, pt_d_t, t_d_pt  
-
-    REAL, DIMENSION(:,:), ALLOCATABLE   ::  precipitation_amount, &
-                                            precipitation_rate
+    REAL(wp) ::  a_1 = 8.69E-4,     & !: coef. in turb. parametrization (cm-2 s3)
+                 a_2 = -7.38E-5,    & !: coef. in turb. parametrization (cm-2 s3)
+                 a_3 = -1.40E-2,    & !: coef. in turb. parametrization
+                 a_term = 9.65,     & !: coef. for terminal velocity (m s-1)
+                 a_vent = 0.78,     & !: coef. for ventilation effect
+                 b_1 = 11.45E-6,    & !: coef. in turb. parametrization (m)
+                 b_2 = 9.68E-6,     & !: coef. in turb. parametrization (m)
+                 b_3 = 0.62,        & !: coef. in turb. parametrization
+                 b_term = 9.8,      & !: coef. for terminal velocity (m s-1)
+                 b_vent = 0.308,    & !: coef. for ventilation effect
+                 beta_cc = 3.09E-4, & !: coef. in turb. parametrization (cm-2 s3)
+                 bfactor,           &
+                 c_1 = 4.82E-6,     & !: coef. in turb. parametrization (m)
+                 c_2 = 4.8E-6,      & !: coef. in turb. parametrization (m)
+                 c_3 = 0.76,        & !: coef. in turb. parametrization
+                 c_const = 0.93,    & !: const. in Taylor-microscale Reynolds number
+                 c_evap = 0.7,      & !: constant in evaporation
+                 c_sedimentation = 2.0, & !: Courant number of sedimentation process
+                 c_term = 600.0,    & !: coef. for terminal velocity (m-1)
+                 cof(6) = (/ 76.18009172947146,      & !: coefficients in the 
+                             -86.50532032941677,     & !: numerical
+                             24.01409824083091,      & !: calculation of the
+                             -1.231739572450155,     & !: gamma function
+                             0.1208650973866179E-2,  &
+                             -0.5395239384953E-5 /), &
+                cp = 1005.0,       & !: heat capacity of dry air (J kg-1 K-1) 
+                diff_coeff_l = 0.23E-4, & !: diffusivity of water vapor (m2 s-1)
+                effective_coll_efficiency, & !:
+                eps_ros = 1.0E-4,  & !: accuracy of Rosenbrock method
+                eps_sb = 1.0E-20,  & !: threshold in two-moments scheme
+                k_cc = 9.44E09,    & !: const. cloud-cloud kernel (m3 kg-2 s-1) 
+                k_cr0 = 4.33,      & !: const. cloud-rain kernel (m3 kg-1 s-1) 
+                k_rr = 7.12,       & !: const. rain-rain kernel (m3 kg-1 s-1) 
+                k_br = 1000.,      & !: const. in breakup parametrization (m-1)
+                k_st = 1.2E8,      & !: const. in drizzle parametrization (m-1 s-1)
+                kappa_rr = 60.7,   & !: const. in collision kernel (kg-1/3)
+                kin_vis_air = 1.4086E-5, & !: kin. viscosity of air (m2 s-1)
+                l_v = 2.5E+06,     & !: latent heat of vaporization (J kg-1)
+                l_d_cp, l_d_r, l_d_rv, & !: l_v / cp, l_v / r_d, l_v / r_v
+                mass_of_solute = 1.0E-17, & !: soluted NaCl (kg)
+                molecular_weight_of_solute = 0.05844, & !: mol. m. NaCl (kg mol-1)
+                molecular_weight_of_water = 0.01801528, & !: mol. m. H2O (kg mol-1)
+                nc_const = 70.0E6, & !: cloud droplet concentration
+                prec_time_const = 0.001, & !: coef. in Kessler scheme
+                pirho_l, dpirho_l, & !: pi * rho_l / 6.0; 6.0 / ( pi * rho_l )
+                rho_l = 1.0E3,     & !: density of water (kg m-3)
+                ql_crit = 0.0005,  & !: coef. in Kessler scheme
+                r_d = 287.0,       & !: sp. gas const. dry air (J kg-1 K-1)
+                r_v = 461.51,      & !: sp. gas const. water vapor (J kg-1 K-1)
+                schmidt = 0.71,    & !: Schmidt number
+                schmidt_p_1d3,     & !: schmidt**( 1.0 / 3.0 )
+                sigma_gc = 1.3,    & !: log-normal geometric standard deviation
+                stp = 2.5066282746310005, & !: parameter in gamma function
+                thermal_conductivity_l = 2.43E-2, & !: therm. cond. air (J m-1 s-1 K-1)
+                vanthoff = 2.0,    & !: van't Hoff factor for NaCl
+                x0 = 2.6E-10,      & !: separating drop mass (kg)
+                xrmin = 2.6E-10,   & !: minimum rain drop size (kg)
+                xrmax = 5.0E-6,    & !: maximum rain drop site (kg)
+                dt_precipitation = 100.0, & !: timestep precipitation (s)
+                w_precipitation = 9.65      !: maximum terminal velocity (m s-1)
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE     ::  hyrho, pt_d_t, t_d_pt  
+
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE   ::  precipitation_amount, &
+                                                precipitation_rate
 !
 !-- 3D array of precipitation rate
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  prr
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  prr
 
     SAVE
@@ -629,7 +427,8 @@
 ! Definition of general constants
 !------------------------------------------------------------------------------!
-
-    REAL    ::  pi = 3.141592654
-    REAL    ::  adv_mom_1, adv_mom_3, adv_mom_5, adv_sca_1, adv_sca_3, adv_sca_5
+    USE kinds
+
+    REAL(wp)  ::  pi = 3.141592654_wp
+    REAL(wp)  ::  adv_mom_1, adv_mom_3, adv_mom_5, adv_sca_1, adv_sca_3, adv_sca_5
     
 
@@ -648,8 +447,9 @@
 ! Definition of parameters for program control
 !------------------------------------------------------------------------------!
+    USE kinds
 
     TYPE plot_precision
        CHARACTER (LEN=8) ::  variable
-       INTEGER           ::  precision
+       INTEGER(iwp)      ::  precision
     END TYPE plot_precision
 
@@ -722,59 +522,59 @@
     CHARACTER (LEN=10), DIMENSION(0:1,100) ::  do2d = ' ', do3d = ' '
 
-    INTEGER ::  abort_mode = 1, average_count_pr = 0, average_count_sp = 0, &
-                average_count_3d = 0, current_timestep_number = 0, &
-                coupling_topology = 0, &
-                dist_range = 0, disturbance_level_ind_b, &
-                disturbance_level_ind_t, doav_n = 0, dopr_n = 0, &
-                dopr_time_count = 0, dopts_time_count = 0, &
-                dosp_time_count = 0, dots_time_count = 0, &
-                do2d_xy_n = 0, do2d_xz_n = 0, do2d_yz_n = 0, do3d_avs_n = 0, &
-                dp_level_ind_b = 0, dvrp_filecount = 0, &
-                dz_stretch_level_index, gamma_mg, gathered_size, &
-                grid_level, ibc_e_b, ibc_p_b, ibc_p_t, &
-                ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, &
-                ibc_sa_t, ibc_uv_b, ibc_uv_t, icloud_scheme, &
-                inflow_disturbance_begin = -1, inflow_disturbance_end = -1, &
-                intermediate_timestep_count, intermediate_timestep_count_max, &
-                io_group = 0, io_blocks = 1, iran = -1234567, &
-                masks = 0, maximum_grid_level, &
-                maximum_parallel_io_streams = -1, max_pr_user = 0, &
-                mgcycles = 0, mg_cycles = -1, mg_switch_to_pe0_level = 0, mid, &
-                nlsf = 1000, ntnudge = 100, netcdf_data_format = 2, ngsrb = 2, &
-                nr_timesteps_this_run = 0, &
-                nsor = 20, nsor_ini = 100, n_sor, normalizing_region = 0, &
-                nz_do3d = -9999, pch_index = 0, prt_time_count = 0, &
-                recycling_plane, runnr = 0, &
-                skip_do_avs = 0, subdomain_size, terminate_coupled = 0, &
-                terminate_coupled_remote = 0, timestep_count = 0
-
-    INTEGER ::  dist_nxl(0:1), dist_nxr(0:1), dist_nyn(0:1), dist_nys(0:1), &
-                do2d_no(0:1) = 0, do2d_xy_time_count(0:1), &
-                do2d_xz_time_count(0:1), do2d_yz_time_count(0:1), &
-                do3d_no(0:1) = 0, do3d_time_count(0:1), &
-                domask_no(max_masks,0:1) = 0, domask_time_count(max_masks,0:1),&
-                lad_vertical_gradient_level_ind(10) = -9999, &
-                mask_size(max_masks,3) = -1, mask_size_l(max_masks,3) = -1, &
-                mask_start_l(max_masks,3) = -1, &
-                pt_vertical_gradient_level_ind(10) = -9999, &
-                q_vertical_gradient_level_ind(10) = -9999, &
-                sa_vertical_gradient_level_ind(10) = -9999, &
-                section(100,3), section_xy(100) = -9999, &
-                section_xz(100) = -9999, section_yz(100) = -9999, &
-                ug_vertical_gradient_level_ind(10) = -9999, &
-                vg_vertical_gradient_level_ind(10) = -9999, &
-                subs_vertical_gradient_level_i(10) = -9999
+    INTEGER(iwp) ::  abort_mode = 1, average_count_pr = 0, average_count_sp = 0, &
+                     average_count_3d = 0, current_timestep_number = 0, &
+                     coupling_topology = 0, &
+                     dist_range = 0, disturbance_level_ind_b, &
+                     disturbance_level_ind_t, doav_n = 0, dopr_n = 0, &
+                     dopr_time_count = 0, dopts_time_count = 0, &
+                     dosp_time_count = 0, dots_time_count = 0, &
+                     do2d_xy_n = 0, do2d_xz_n = 0, do2d_yz_n = 0, do3d_avs_n = 0, &
+                     dp_level_ind_b = 0, dvrp_filecount = 0, &
+                     dz_stretch_level_index, gamma_mg, gathered_size, &
+                     grid_level, ibc_e_b, ibc_p_b, ibc_p_t, &
+                     ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, &
+                     ibc_sa_t, ibc_uv_b, ibc_uv_t, icloud_scheme, &
+                     inflow_disturbance_begin = -1, inflow_disturbance_end = -1, &
+                     intermediate_timestep_count, intermediate_timestep_count_max, &
+                     io_group = 0, io_blocks = 1, iran = -1234567, &
+                     masks = 0, maximum_grid_level, &
+                     maximum_parallel_io_streams = -1, max_pr_user = 0, &
+                     mgcycles = 0, mg_cycles = -1, mg_switch_to_pe0_level = 0, mid, &
+                     nlsf = 1000, ntnudge = 100, netcdf_data_format = 2, ngsrb = 2, &
+                     nr_timesteps_this_run = 0, &
+                     nsor = 20, nsor_ini = 100, n_sor, normalizing_region = 0, &
+                     nz_do3d = -9999, pch_index = 0, prt_time_count = 0, &
+                     recycling_plane, runnr = 0, &
+                     skip_do_avs = 0, subdomain_size, terminate_coupled = 0, &
+                     terminate_coupled_remote = 0, timestep_count = 0
+
+    INTEGER(iwp) ::  dist_nxl(0:1), dist_nxr(0:1), dist_nyn(0:1), dist_nys(0:1), &
+                     do2d_no(0:1) = 0, do2d_xy_time_count(0:1), &
+                     do2d_xz_time_count(0:1), do2d_yz_time_count(0:1), &
+                     do3d_no(0:1) = 0, do3d_time_count(0:1), &
+                     domask_no(max_masks,0:1) = 0, domask_time_count(max_masks,0:1),&
+                     lad_vertical_gradient_level_ind(10) = -9999, &
+                     mask_size(max_masks,3) = -1, mask_size_l(max_masks,3) = -1, &
+                     mask_start_l(max_masks,3) = -1, &
+                     pt_vertical_gradient_level_ind(10) = -9999, &
+                     q_vertical_gradient_level_ind(10) = -9999, &
+                     sa_vertical_gradient_level_ind(10) = -9999, &
+                     section(100,3), section_xy(100) = -9999, &
+                     section_xz(100) = -9999, section_yz(100) = -9999, &
+                     ug_vertical_gradient_level_ind(10) = -9999, &
+                     vg_vertical_gradient_level_ind(10) = -9999, &
+                     subs_vertical_gradient_level_i(10) = -9999
 
 #if defined ( __check )
-    INTEGER :: check_restart = 0
+    INTEGER(iwp) :: check_restart = 0
 #endif
 
-    INTEGER, DIMENSION(0:1) :: ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz, ntdim_3d
-
-    INTEGER, DIMENSION(:), ALLOCATABLE ::  grid_level_count
-
-    INTEGER, DIMENSION(:,:), ALLOCATABLE   ::  mask_i, mask_j, mask_k
-    INTEGER, DIMENSION(:,:), ALLOCATABLE   ::  &
-                mask_i_global, mask_j_global, mask_k_global
+    INTEGER(iwp), DIMENSION(0:1) :: ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz, ntdim_3d
+
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  grid_level_count
+
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE   ::  mask_i, mask_j, mask_k
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE   ::  &
+                    mask_i_global, mask_j_global, mask_k_global
 
     LOGICAL ::  avs_output = .FALSE., &
@@ -829,115 +629,115 @@
                 data_output_yz(0:1) = .FALSE.
 
-    REAL ::  advected_distance_x = 0.0, advected_distance_y = 0.0, &
-             alpha_surface = 0.0, atmos_ocean_sign = 1.0, &
-             averaging_interval = 0.0, averaging_interval_pr = 9999999.9, &
-             averaging_interval_sp = 9999999.9, bc_pt_t_val, bc_q_t_val, &
-             bottom_salinityflux = 0.0, &
-             building_height = 50.0, building_length_x = 50.0, &
-             building_length_y = 50.0, building_wall_left = 9999999.9, &
-             building_wall_south = 9999999.9, canyon_height = 50.0, &
-             canyon_width_x = 9999999.9, canyon_width_y = 9999999.9, &
-             canyon_wall_left = 9999999.9, canyon_wall_south = 9999999.9, &
-             cthf = 0.0, cfl_factor = -1.0, cos_alpha_surface, &
-             coupling_start_time = 0.0, disturbance_amplitude = 0.25, &
-             disturbance_energy_limit = 0.01, &
-             disturbance_level_b = -9999999.9, &
-             disturbance_level_t = -9999999.9, &
-             dp_level_b = 0.0, drag_coefficient = 0.0, &
-             dt = -1.0, dt_averaging_input = 0.0, &
-             dt_averaging_input_pr = 9999999.9, dt_coupling = 9999999.9, &
-             dt_data_output = 9999999.9, &
-             dt_data_output_av = 9999999.9, dt_disturb = 9999999.9, &
-             dt_dopr = 9999999.9, dt_dopr_listing = 9999999.9, &
-             dt_dopts = 9999999.9, dt_dosp = 9999999.9, dt_dots = 9999999.9, &
-             dt_do2d_xy = 9999999.9, dt_do2d_xz = 9999999.9, &
-             dt_do2d_yz = 9999999.9, dt_do3d = 9999999.9, dt_dvrp = 9999999.9, &
-             dt_max = 20.0, dt_micro = -1.0, dt_restart = 9999999.9, &
-             dt_run_control = 60.0, dt_3d = -1.0, dz = -1.0, &
-             dz_max = 9999999.9, dz_stretch_factor = 1.08, &
-             dz_stretch_level = 100000.0, e_init = 0.0, e_min = 0.0, &
-             end_time = 0.0, &
-             f = 0.0, fs = 0.0, g = 9.81, inflow_damping_height = 9999999.9, &
-             inflow_damping_width = 9999999.9, kappa = 0.4, km_constant = -1.0,&
-             lad_surface = 0.0, leaf_surface_concentration = 0.0, &
-             mask_scale_x = 1.0, mask_scale_y = 1.0, mask_scale_z = 1.0, &
-             maximum_cpu_time_allowed = 0.0,  &
-             molecular_viscosity = 1.461E-5, &
-             old_dt = 1.0E-10, omega = 7.29212E-5, omega_sor = 1.8, &
-             particle_maximum_age = 9999999.9, &
-             phi = 55.0, prandtl_number = 1.0, &
-             precipitation_amount_interval = 9999999.9, prho_reference, &
-             pt_damping_factor = 0.0, pt_damping_width = 0.0, &
-             pt_reference = 9999999.9, pt_slope_offset = 0.0, &
-             pt_surface = 300.0, pt_surface_initial_change = 0.0, &
-             q_surface = 0.0, q_surface_initial_change = 0.0, &
-             rayleigh_damping_factor = -1.0, rayleigh_damping_height = -1.0, &
-             recycling_width = 9999999.9, residual_limit = 1.0E-4, &
-             restart_time = 9999999.9, rho_reference, rho_surface, &
-             rif_max = 1.0, rif_min = -5.0, roughness_length = 0.1, &
-             sa_surface = 35.0, scalar_exchange_coefficient = 0.0, &
-             simulated_time = 0.0, simulated_time_at_begin, sin_alpha_surface, &
-             skip_time_data_output = 0.0, skip_time_data_output_av = 9999999.9,&
-             skip_time_dopr = 9999999.9, skip_time_dosp = 9999999.9, &
-             skip_time_do2d_xy = 9999999.9, skip_time_do2d_xz = 9999999.9, &
-             skip_time_do2d_yz = 9999999.9, skip_time_do3d = 9999999.9, &
-             surface_heatflux = 9999999.9, surface_pressure = 1013.25, &
-             surface_scalarflux = 9999999.9, surface_waterflux = 9999999.9, &
-             s_surface = 0.0, s_surface_initial_change = 0.0, &
-             termination_time_needed = -1.0, time_coupling = 0.0, &
-             time_disturb = 0.0, time_dopr = 0.0, time_dopr_av = 0.0, &
-             time_dopr_listing = 0.0, time_dopts = 0.0, time_dosp = 0.0, &
-             time_dosp_av = 0.0, time_dots = 0.0, time_do2d_xy = 0.0, &
-             time_do2d_xz = 0.0, time_do2d_yz = 0.0, time_do3d = 0.0, &
-             time_do_av = 0.0, time_do_sla = 0.0, time_dvrp = 0.0, &
-             time_restart = 9999999.9, time_run_control = 0.0,&
-             time_since_reference_point, top_heatflux = 9999999.9, &
-             top_momentumflux_u = 9999999.9, &
-             top_momentumflux_v = 9999999.9, top_salinityflux = 9999999.9, &
-             ug_surface = 0.0, u_bulk = 0.0, u_gtrans = 0.0, &
-             vg_surface = 0.0, vpt_reference = 9999999.9, &
-             v_bulk = 0.0, v_gtrans = 0.0, wall_adjustment_factor = 1.8, &
-             z_max_do2d = -1.0, z0h_factor = 1.0
-
-    REAL ::  do2d_xy_last_time(0:1) = -1.0, do2d_xz_last_time(0:1) = -1.0, &
-             do2d_yz_last_time(0:1) = -1.0, dpdxy(1:2) = 0.0, &
-             dt_domask(max_masks) = 9999999.9, lad_vertical_gradient(10) = 0.0,&
-             lad_vertical_gradient_level(10) = -9999999.9, &
-             mask_scale(3), &
-             pt_vertical_gradient(10) = 0.0, &
-             pt_vertical_gradient_level(10) = -9999999.9, &
-             q_vertical_gradient(10) = 0.0, &
-             q_vertical_gradient_level(10) = -1.0, &
-             s_vertical_gradient(10) = 0.0, &
-             s_vertical_gradient_level(10) = -1.0, &
-             sa_vertical_gradient(10) = 0.0, &
-             sa_vertical_gradient_level(10) = -9999999.9, &
-             skip_time_domask(max_masks) = 9999999.9, threshold(20) = 0.0, &
-             time_domask(max_masks) = 0.0, &
-             tsc(10) = (/ 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 /), &
-             u_profile(100) = 9999999.9, uv_heights(100) = 9999999.9, &
-             v_profile(100) = 9999999.9, &
-             ug_vertical_gradient(10) = 0.0, &
-             ug_vertical_gradient_level(10) = -9999999.9, &
-             vg_vertical_gradient(10) = 0.0, &
-             vg_vertical_gradient_level(10) = -9999999.9, &
-             volume_flow(1:2) = 0.0, volume_flow_area(1:2) = 0.0, &
-             volume_flow_initial(1:2) = 0.0, wall_heatflux(0:4) = 0.0, &
-             wall_humidityflux(0:4) = 0.0, wall_nrflux(0:4) = 0.0, &
-             wall_qflux(0:4) = 0.0, wall_qrflux(0:4) = 0.0, &
-             wall_salinityflux(0:4) = 0.0, wall_scalarflux(0:4) = 0.0, &
-             subs_vertical_gradient(10) = 0.0, &
-             subs_vertical_gradient_level(10) = -9999999.9
-
-    REAL, DIMENSION(:), ALLOCATABLE ::  dp_smooth_factor
-
-    REAL, DIMENSION(max_masks,mask_xyz_dimension) :: &
-        mask_x = -1.0, mask_y = -1.0, mask_z = -1.0
-    REAL, DIMENSION(max_masks,3) ::                  &
-        mask_x_loop = -1.0, mask_y_loop = -1.0, mask_z_loop = -1.0
+    REAL(wp) ::  advected_distance_x = 0.0, advected_distance_y = 0.0, &
+                 alpha_surface = 0.0, atmos_ocean_sign = 1.0, &
+                 averaging_interval = 0.0, averaging_interval_pr = 9999999.9, &
+                 averaging_interval_sp = 9999999.9, bc_pt_t_val, bc_q_t_val, &
+                 bottom_salinityflux = 0.0, &
+                 building_height = 50.0, building_length_x = 50.0, &
+                 building_length_y = 50.0, building_wall_left = 9999999.9, &
+                 building_wall_south = 9999999.9, canyon_height = 50.0, &
+                 canyon_width_x = 9999999.9, canyon_width_y = 9999999.9, &
+                 canyon_wall_left = 9999999.9, canyon_wall_south = 9999999.9, &
+                 cthf = 0.0, cfl_factor = -1.0, cos_alpha_surface, &
+                 coupling_start_time = 0.0, disturbance_amplitude = 0.25, &
+                 disturbance_energy_limit = 0.01, &
+                 disturbance_level_b = -9999999.9, &
+                 disturbance_level_t = -9999999.9, &
+                 dp_level_b = 0.0, drag_coefficient = 0.0, &
+                 dt = -1.0, dt_averaging_input = 0.0, &
+                 dt_averaging_input_pr = 9999999.9, dt_coupling = 9999999.9, &
+                 dt_data_output = 9999999.9, &
+                 dt_data_output_av = 9999999.9, dt_disturb = 9999999.9, &
+                 dt_dopr = 9999999.9, dt_dopr_listing = 9999999.9, &
+                 dt_dopts = 9999999.9, dt_dosp = 9999999.9, dt_dots = 9999999.9, &
+                 dt_do2d_xy = 9999999.9, dt_do2d_xz = 9999999.9, &
+                 dt_do2d_yz = 9999999.9, dt_do3d = 9999999.9, dt_dvrp = 9999999.9, &
+                 dt_max = 20.0, dt_micro = -1.0, dt_restart = 9999999.9, &
+                 dt_run_control = 60.0, dt_3d = -1.0, dz = -1.0, &
+                 dz_max = 9999999.9, dz_stretch_factor = 1.08, &
+                 dz_stretch_level = 100000.0, e_init = 0.0, e_min = 0.0, &
+                 end_time = 0.0, &
+                 f = 0.0, fs = 0.0, g = 9.81, inflow_damping_height = 9999999.9, &
+                 inflow_damping_width = 9999999.9, kappa = 0.4, km_constant = -1.0,&
+                 lad_surface = 0.0, leaf_surface_concentration = 0.0, &
+                 mask_scale_x = 1.0, mask_scale_y = 1.0, mask_scale_z = 1.0, &
+                 maximum_cpu_time_allowed = 0.0,  &
+                 molecular_viscosity = 1.461E-5, &
+                 old_dt = 1.0E-10, omega = 7.29212E-5, omega_sor = 1.8, &
+                 particle_maximum_age = 9999999.9, &
+                 phi = 55.0, prandtl_number = 1.0, &
+                 precipitation_amount_interval = 9999999.9, prho_reference, &
+                 pt_damping_factor = 0.0, pt_damping_width = 0.0, &
+                 pt_reference = 9999999.9, pt_slope_offset = 0.0, &
+                 pt_surface = 300.0, pt_surface_initial_change = 0.0, &
+                 q_surface = 0.0, q_surface_initial_change = 0.0, &
+                 rayleigh_damping_factor = -1.0, rayleigh_damping_height = -1.0, &
+                 recycling_width = 9999999.9, residual_limit = 1.0E-4, &
+                 restart_time = 9999999.9, rho_reference, rho_surface, &
+                 rif_max = 1.0, rif_min = -5.0, roughness_length = 0.1, &
+                 sa_surface = 35.0, scalar_exchange_coefficient = 0.0, &
+                 simulated_time = 0.0, simulated_time_at_begin, sin_alpha_surface, &
+                 skip_time_data_output = 0.0, skip_time_data_output_av = 9999999.9,&
+                 skip_time_dopr = 9999999.9, skip_time_dosp = 9999999.9, &
+                 skip_time_do2d_xy = 9999999.9, skip_time_do2d_xz = 9999999.9, &
+                 skip_time_do2d_yz = 9999999.9, skip_time_do3d = 9999999.9, &
+                 surface_heatflux = 9999999.9, surface_pressure = 1013.25, &
+                 surface_scalarflux = 9999999.9, surface_waterflux = 9999999.9, &
+                 s_surface = 0.0, s_surface_initial_change = 0.0, &
+                 termination_time_needed = -1.0, time_coupling = 0.0, &
+                 time_disturb = 0.0, time_dopr = 0.0, time_dopr_av = 0.0, &
+                 time_dopr_listing = 0.0, time_dopts = 0.0, time_dosp = 0.0, &
+                 time_dosp_av = 0.0, time_dots = 0.0, time_do2d_xy = 0.0, &
+                 time_do2d_xz = 0.0, time_do2d_yz = 0.0, time_do3d = 0.0, &
+                 time_do_av = 0.0, time_do_sla = 0.0, time_dvrp = 0.0, &
+                 time_restart = 9999999.9, time_run_control = 0.0,&
+                 time_since_reference_point, top_heatflux = 9999999.9, &
+                 top_momentumflux_u = 9999999.9, &
+                 top_momentumflux_v = 9999999.9, top_salinityflux = 9999999.9, &
+                 ug_surface = 0.0, u_bulk = 0.0, u_gtrans = 0.0, &
+                 vg_surface = 0.0, vpt_reference = 9999999.9, &
+                 v_bulk = 0.0, v_gtrans = 0.0, wall_adjustment_factor = 1.8, &
+                 z_max_do2d = -1.0, z0h_factor = 1.0
+
+    REAL(wp) ::  do2d_xy_last_time(0:1) = -1.0, do2d_xz_last_time(0:1) = -1.0, &
+                 do2d_yz_last_time(0:1) = -1.0, dpdxy(1:2) = 0.0, &
+                 dt_domask(max_masks) = 9999999.9, lad_vertical_gradient(10) = 0.0,&
+                 lad_vertical_gradient_level(10) = -9999999.9, &
+                 mask_scale(3), &
+                 pt_vertical_gradient(10) = 0.0, &
+                 pt_vertical_gradient_level(10) = -9999999.9, &
+                 q_vertical_gradient(10) = 0.0, &
+                 q_vertical_gradient_level(10) = -1.0, &
+                 s_vertical_gradient(10) = 0.0, &
+                 s_vertical_gradient_level(10) = -1.0, &
+                 sa_vertical_gradient(10) = 0.0, &
+                 sa_vertical_gradient_level(10) = -9999999.9, &
+                 skip_time_domask(max_masks) = 9999999.9, threshold(20) = 0.0, &
+                 time_domask(max_masks) = 0.0, &
+                 tsc(10) = (/ 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 /), &
+                 u_profile(100) = 9999999.9, uv_heights(100) = 9999999.9, &
+                 v_profile(100) = 9999999.9, &
+                 ug_vertical_gradient(10) = 0.0, &
+                 ug_vertical_gradient_level(10) = -9999999.9, &
+                 vg_vertical_gradient(10) = 0.0, &
+                 vg_vertical_gradient_level(10) = -9999999.9, &
+                 volume_flow(1:2) = 0.0, volume_flow_area(1:2) = 0.0, &
+                 volume_flow_initial(1:2) = 0.0, wall_heatflux(0:4) = 0.0, &
+                 wall_humidityflux(0:4) = 0.0, wall_nrflux(0:4) = 0.0, &
+                 wall_qflux(0:4) = 0.0, wall_qrflux(0:4) = 0.0, &
+                 wall_salinityflux(0:4) = 0.0, wall_scalarflux(0:4) = 0.0, &
+                 subs_vertical_gradient(10) = 0.0, &
+                 subs_vertical_gradient_level(10) = -9999999.9
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  dp_smooth_factor
+
+    REAL(wp), DIMENSION(max_masks,mask_xyz_dimension) :: &
+            mask_x = -1.0, mask_y = -1.0, mask_z = -1.0
+    REAL(wp), DIMENSION(max_masks,3) ::                  &
+            mask_x_loop = -1.0, mask_y_loop = -1.0, mask_z_loop = -1.0
     
 !
 !--    internal mask arrays ("mask,dimension,selection")
-       REAL, DIMENSION(:,:,:), ALLOCATABLE ::  mask, mask_loop
+       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  mask, mask_loop
 
     SAVE
@@ -954,4 +754,6 @@
 ! Definition of variables used with dvrp-software
 !------------------------------------------------------------------------------!
+
+     USE kinds
 
     CHARACTER (LEN=10) ::  dvrp_output = 'rtsp', particle_color = 'none', &
@@ -967,14 +769,14 @@
                            dvrp_username  = ' '
 
-    INTEGER ::  cluster_size = 1, dvrp_colortable_entries = 4,                 &
-                dvrp_colortable_entries_prt = 22, islice_dvrp,                 &
-                nx_dvrp, nxl_dvrp, nxr_dvrp, ny_dvrp, nyn_dvrp, nys_dvrp,      &
-                nz_dvrp, pathlines_fadeintime = 5, pathlines_fadeouttime = 5,  &
-                pathlines_linecount = 1000, pathlines_maxhistory = 40,         &
-                pathlines_wavecount = 10, pathlines_wavetime = 50,             &
-                vc_gradient_normals = 0, vc_mode = 0, vc_size_x = 2,           &
-                vc_size_y = 2, vc_size_z = 2
-
-    INTEGER, DIMENSION(10) ::  slicer_position_dvrp
+    INTEGER(iwp) ::  cluster_size = 1, dvrp_colortable_entries = 4,                 &
+                     dvrp_colortable_entries_prt = 22, islice_dvrp,                 &
+                     nx_dvrp, nxl_dvrp, nxr_dvrp, ny_dvrp, nyn_dvrp, nys_dvrp,      &
+                     nz_dvrp, pathlines_fadeintime = 5, pathlines_fadeouttime = 5,  &
+                     pathlines_linecount = 1000, pathlines_maxhistory = 40,         &
+                     pathlines_wavecount = 10, pathlines_wavetime = 50,             &
+                     vc_gradient_normals = 0, vc_mode = 0, vc_size_x = 2,           &
+                     vc_size_y = 2, vc_size_z = 2
+
+    INTEGER(iwp), DIMENSION(10) ::  slicer_position_dvrp
 
     LOGICAL ::  cyclic_dvrp = .FALSE., dvrp_overlap, dvrp_total_overlap, &
@@ -982,53 +784,53 @@
                 use_seperate_pe_for_dvrp_output = .FALSE.
 
-    REAL    ::  clip_dvrp_l = 9999999.9, clip_dvrp_n = 9999999.9, &
-                clip_dvrp_r = 9999999.9, clip_dvrp_s = 9999999.9, &
-                superelevation = 1.0, superelevation_x = 1.0,     &
-                superelevation_y = 1.0, vc_alpha = 38.0
-
-    REAL, DIMENSION(2) ::  color_interval = (/ 0.0, 1.0 /), &
-                           dvrpsize_interval = (/ 0.0, 1.0 /)
-
-    REAL, DIMENSION(3) ::  groundplate_color = (/ 0.0, 0.6, 0.0 /), &
-                           topography_color = (/ 0.8, 0.7, 0.6 /)
+    REAL(wp)    ::  clip_dvrp_l = 9999999.9, clip_dvrp_n = 9999999.9, &
+                    clip_dvrp_r = 9999999.9, clip_dvrp_s = 9999999.9, &
+                    superelevation = 1.0, superelevation_x = 1.0,     &
+                    superelevation_y = 1.0, vc_alpha = 38.0
+
+    REAL(wp), DIMENSION(2) ::  color_interval = (/ 0.0, 1.0 /), &
+                               dvrpsize_interval = (/ 0.0, 1.0 /)
+
+    REAL(wp), DIMENSION(3) ::  groundplate_color = (/ 0.0, 0.6, 0.0 /), &
+                               topography_color = (/ 0.8, 0.7, 0.6 /)
 
 #if defined( __decalpha )
-    REAL, DIMENSION(2,10)  ::  slicer_range_limits_dvrp = RESHAPE( (/       &
-                                -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, &
-                                -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, &
-                                -1.0, 1.0, -1.0, 1.0 /), (/ 2, 10 /) )
-
-    REAL, DIMENSION(3,10)  ::  isosurface_color = RESHAPE( (/                  &
-                                0.9, 0.9, 0.9,  0.8, 0.1, 0.1,  0.1, 0.1, 0.8, &
-                                0.1, 0.8, 0.1,  0.6, 0.1, 0.1,  0.1, 0.1, 0.6, &
-                                0.1, 0.6, 0.1,  0.4, 0.1, 0.1,  0.1, 0.1, 0.4, &
-                                0.1, 0.4, 0.1 /), (/ 3, 10 /) )
-
-    REAL(4), DIMENSION(2,100) ::  interval_values_dvrp, interval_h_dvrp =      &
-                                  RESHAPE( (/ 270.0, 225.0, 225.0, 180.0,      &
-                                               70.0,  25.0,  25.0, -25.0,      &
-                                              ( 0.0, i9 = 1, 192 ) /),         &
-                                           (/ 2, 100 /) ),                     &
-                                  interval_l_dvrp = 0.5, interval_s_dvrp = 1.0,&
-                                  interval_a_dvrp = 0.0,                       &
-                                  interval_values_dvrp_prt,                    &
-                                  interval_h_dvrp_prt = RESHAPE(               &
-                                  (/ 270.0, 225.0, 225.0, 180.0, 70.0, 25.0,   &
-                                     25.0, -25.0, ( 0.0, i9 = 1, 192 ) /),     &
-                                                  (/ 2, 100 /) ),              &
-                                  interval_l_dvrp_prt = 0.5,                   &
-                                  interval_s_dvrp_prt = 1.0,                   &
-                                  interval_a_dvrp_prt = 0.0
+    REAL(wp), DIMENSION(2,10)  ::  slicer_range_limits_dvrp = RESHAPE( (/      &
+                                   -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, &
+                                   -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, &
+                                   -1.0, 1.0, -1.0, 1.0 /), (/ 2, 10 /) )
+
+    REAL(wp), DIMENSION(3,10)  ::  isosurface_color = RESHAPE( (/                 &
+                                   0.9, 0.9, 0.9,  0.8, 0.1, 0.1,  0.1, 0.1, 0.8, &
+                                   0.1, 0.8, 0.1,  0.6, 0.1, 0.1,  0.1, 0.1, 0.6, &
+                                   0.1, 0.6, 0.1,  0.4, 0.1, 0.1,  0.1, 0.1, 0.4, &
+                                   0.1, 0.4, 0.1 /), (/ 3, 10 /) )
+
+    REAL(sp), DIMENSION(2,100) ::  interval_values_dvrp, interval_h_dvrp =      &
+                                   RESHAPE( (/ 270.0, 225.0, 225.0, 180.0,      &
+                                                70.0,  25.0,  25.0, -25.0,      &
+                                               ( 0.0, i9 = 1, 192 ) /),         &
+                                            (/ 2, 100 /) ),                     &
+                                   interval_l_dvrp = 0.5, interval_s_dvrp = 1.0,&
+                                   interval_a_dvrp = 0.0,                       &
+                                   interval_values_dvrp_prt,                    &
+                                   interval_h_dvrp_prt = RESHAPE(               &
+                                   (/ 270.0, 225.0, 225.0, 180.0, 70.0, 25.0,   &
+                                      25.0, -25.0, ( 0.0, i9 = 1, 192 ) /),     &
+                                                   (/ 2, 100 /) ),              &
+                                   interval_l_dvrp_prt = 0.5,                   &
+                                   interval_s_dvrp_prt = 1.0,                   &
+                                   interval_a_dvrp_prt = 0.0
 #else
-    REAL, DIMENSION(2,10)     ::  slicer_range_limits_dvrp
-
-    REAL, DIMENSION(3,10)     ::  isosurface_color
-
-    REAL(4), DIMENSION(2,100) ::  interval_values_dvrp,                       &
-                                  interval_values_dvrp_prt, interval_h_dvrp,  &
-                                  interval_h_dvrp_prt, interval_l_dvrp = 0.5, &
-                                  interval_l_dvrp_prt = 0.5, interval_s_dvrp = 1.0, &
-                                  interval_s_dvrp_prt = 1.0, interval_a_dvrp = 0.0, &
-                                  interval_a_dvrp_prt = 0.0
+    REAL(wp), DIMENSION(2,10)     ::  slicer_range_limits_dvrp
+
+    REAL(wp), DIMENSION(3,10)     ::  isosurface_color
+
+    REAL(sp), DIMENSION(2,100) ::  interval_values_dvrp,                       &
+                                   interval_values_dvrp_prt, interval_h_dvrp,  &
+                                   interval_h_dvrp_prt, interval_l_dvrp = 0.5, &
+                                   interval_l_dvrp_prt = 0.5, interval_s_dvrp = 1.0, &
+                                   interval_s_dvrp_prt = 1.0, interval_a_dvrp = 0.0, &
+                                   interval_a_dvrp_prt = 0.0
 
     DATA  slicer_range_limits_dvrp / -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, &
@@ -1049,10 +851,10 @@
 #endif
 
-    REAL(4), DIMENSION(:), ALLOCATABLE ::  xcoor_dvrp, ycoor_dvrp, zcoor_dvrp
+    REAL(sp), DIMENSION(:), ALLOCATABLE ::  xcoor_dvrp, ycoor_dvrp, zcoor_dvrp
 
     TYPE steering
        CHARACTER (LEN=24) ::  name
-       REAL(4)            ::  min, max
-       INTEGER            ::  imin, imax
+       REAL(sp)           ::  min, max
+       INTEGER(iwp)       ::  imin, imax
     END TYPE steering
 
@@ -1074,12 +876,14 @@
 !------------------------------------------------------------------------------!
 
-    REAL ::  ddx, ddx2, dx = 1.0, dx2, ddy, ddy2, dy = 1.0, dy2
-
-    REAL, DIMENSION(:), ALLOCATABLE ::  ddx2_mg, ddy2_mg
-
-    REAL, DIMENSION(:,:), ALLOCATABLE ::  fwxm, fwxp, fwym, fwyp, fxm, fxp,   &
-                                          fym, fyp, wall_e_x, wall_e_y,       &
-                                          wall_u, wall_v, wall_w_x, wall_w_y, &
-                                          zu_s_inner, zw_w_inner
+    USE kinds
+
+    REAL(wp) ::  ddx, ddx2, dx = 1.0, dx2, ddy, ddy2, dy = 1.0, dy2
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  ddx2_mg, ddy2_mg
+
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fwxm, fwxp, fwym, fwyp, fxm, fxp,   &
+                                              fym, fyp, wall_e_x, wall_e_y,       &
+                                              wall_u, wall_v, wall_w_x, wall_w_y, &
+                                              zu_s_inner, zw_w_inner
 
     SAVE
@@ -1098,33 +902,35 @@
 !------------------------------------------------------------------------------!
 
-    INTEGER ::  i_left, i_right, j_north, j_south, nbgp = 3, ngp_sums, nnx,    &
-                nx = 0, nx_a, nx_o, nxl, nxlg, nxlu, nxr, nxrg, nx_on_file,    &
-                nny, ny = 0, ny_a, ny_o, nyn, nyng, nys, nysg, nysv,           &
-                ny_on_file, nnz, nz = 0, nzb, nzb_diff, nzb_max, nzt, nzt_diff
-
-
-    INTEGER( KIND = SELECTED_INT_KIND(18) ), DIMENSION(:), ALLOCATABLE ::      &
+    USE kinds
+
+    INTEGER(iwp) ::  i_left, i_right, j_north, j_south, nbgp = 3, ngp_sums, nnx,    &
+                     nx = 0, nx_a, nx_o, nxl, nxlg, nxlu, nxr, nxrg, nx_on_file,    &
+                     nny, ny = 0, ny_a, ny_o, nyn, nyng, nys, nysg, nysv,           &
+                     ny_on_file, nnz, nz = 0, nzb, nzb_diff, nzb_max, nzt, nzt_diff
+
+
+    INTEGER(idp), DIMENSION(:), ALLOCATABLE ::      &
                 ngp_3d, ngp_3d_inner   ! need to have 64 bit for grids > 2E9
 
-    INTEGER, DIMENSION(:), ALLOCATABLE ::                                      &
-                ngp_2dh, nxl_mg, nxr_mg, nyn_mg, nys_mg, nzt_mg
-
-
-    INTEGER, DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_outer, ngp_2dh_s_inner,    &
-                mg_loc_ind, nzb_diff_s_inner, nzb_diff_s_outer, nzb_diff_u,    &
-                nzb_diff_v, nzb_inner, nzb_outer, nzb_s_inner, nzb_s_outer,    &
-                nzb_u_inner, nzb_u_outer, nzb_v_inner, nzb_v_outer,            &
-                nzb_w_inner, nzb_w_outer, nzb_2d
-
-    INTEGER, DIMENSION(:,:,:), POINTER ::  flags
-
-    INTEGER, DIMENSION(:,:,:), ALLOCATABLE ::  wall_flags_0, wall_flags_00
-
-    INTEGER, DIMENSION(:,:,:), ALLOCATABLE,  TARGET ::                         &
-                wall_flags_1, wall_flags_2, wall_flags_3, wall_flags_4,        &
-                wall_flags_5, wall_flags_6, wall_flags_7, wall_flags_8,        &
-                wall_flags_9, wall_flags_10
-
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  rflags_s_inner, rflags_invers
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::                                  &
+                   ngp_2dh, nxl_mg, nxr_mg, nyn_mg, nys_mg, nzt_mg
+
+
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_outer, ngp_2dh_s_inner,  &
+                   mg_loc_ind, nzb_diff_s_inner, nzb_diff_s_outer, nzb_diff_u,    &
+                   nzb_diff_v, nzb_inner, nzb_outer, nzb_s_inner, nzb_s_outer,    &
+                   nzb_u_inner, nzb_u_outer, nzb_v_inner, nzb_v_outer,            &
+                   nzb_w_inner, nzb_w_outer, nzb_2d
+
+    INTEGER(iwp), DIMENSION(:,:,:), POINTER ::  flags
+
+    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  wall_flags_0, wall_flags_00
+
+    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE,  TARGET ::                       &
+                   wall_flags_1, wall_flags_2, wall_flags_3, wall_flags_4,        &
+                   wall_flags_5, wall_flags_6, wall_flags_7, wall_flags_8,        &
+                   wall_flags_9, wall_flags_10
+
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  rflags_s_inner, rflags_invers
 
     SAVE
@@ -1147,11 +953,14 @@
        SUBROUTINE global_min_max ( i1, i2, j1, j2, k1, k2, feld, mode, offset, &
                                    wert, wert_ijk, wert1, wert1_ijk )
-          CHARACTER (LEN=*), INTENT(IN) ::  mode
-          INTEGER, INTENT(IN)           ::  i1, i2, j1, j2, k1, k2
-          INTEGER                       ::  wert_ijk(3)
-          INTEGER, OPTIONAL             ::  wert1_ijk(3)
-          REAL                          ::  offset, wert
-          REAL, OPTIONAL                ::  wert1
-          REAL, INTENT(IN)              ::  feld(i1:i2,j1:j2,k1:k2)
+
+          USE kinds
+
+          CHARACTER (LEN=*), INTENT(IN)      ::  mode
+          INTEGER(iwp), INTENT(IN)           ::  i1, i2, j1, j2, k1, k2
+          INTEGER(iwp)                       ::  wert_ijk(3)
+          INTEGER(iwp), OPTIONAL             ::  wert1_ijk(3)
+          REAL(wp)                           ::  offset, wert
+          REAL(wp), OPTIONAL                 ::  wert1
+          REAL(wp), INTENT(IN)               ::  feld(i1:i2,j1:j2,k1:k2)
 
        END SUBROUTINE global_min_max
@@ -1178,9 +987,11 @@
        SUBROUTINE advec_s_bc( sk, sk_char )
 
+          USE kinds
+
           CHARACTER (LEN=*), INTENT(IN)   ::  sk_char
 #if defined( __nopointer )
-          REAL, DIMENSION(:,:,:) ::  sk
+          REAL(wp), DIMENSION(:,:,:) ::  sk
 #else
-          REAL, DIMENSION(:,:,:), POINTER ::  sk
+          REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
 #endif
        END SUBROUTINE advec_s_bc
@@ -1204,19 +1015,21 @@
 !------------------------------------------------------------------------------!
 
-    INTEGER ::  current_timestep_number_1d = 0, damp_level_ind_1d
+    USE kinds
+
+    INTEGER(iwp) ::  current_timestep_number_1d = 0, damp_level_ind_1d
 
     LOGICAL ::  run_control_header_1d = .FALSE., stop_dt_1d = .FALSE. 
 
-    REAL ::     damp_level_1d = -1.0, dt_1d = 60.0, dt_max_1d = 300.0, &
-                dt_pr_1d = 9999999.9, dt_run_control_1d = 60.0, &
-                end_time_1d = 864000.0, old_dt_1d = 1.0E-10, &
-                qs1d, simulated_time_1d = 0.0, time_pr_1d = 0.0, &
-                time_run_control_1d = 0.0, ts1d, us1d, usws1d, &
-                vsws1d, z01d, z0h1d
-
-
-    REAL, DIMENSION(:), ALLOCATABLE ::  e1d, e1d_p, kh1d, km1d, l_black, l1d,  &
-                                        rif1d, te_e, te_em, te_u, te_um, te_v, &
-                                        te_vm, u1d, u1d_p, v1d, v1d_p
+    REAL(wp) ::     damp_level_1d = -1.0, dt_1d = 60.0, dt_max_1d = 300.0, &
+                    dt_pr_1d = 9999999.9, dt_run_control_1d = 60.0, &
+                    end_time_1d = 864000.0, old_dt_1d = 1.0E-10, &
+                    qs1d, simulated_time_1d = 0.0, time_pr_1d = 0.0, &
+                    time_run_control_1d = 0.0, ts1d, us1d, usws1d, &
+                    vsws1d, z01d, z0h1d
+
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  e1d, e1d_p, kh1d, km1d, l_black, l1d,  &
+                                            rif1d, te_e, te_em, te_u, te_um, te_v, &
+                                            te_vm, u1d, u1d_p, v1d, v1d_p
 
     SAVE
@@ -1235,12 +1048,13 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
+    USE control_parameters, ONLY: max_masks
+    USE kinds
 #if defined( __netcdf )
     USE netcdf
 #endif
 
-    INTEGER, PARAMETER ::  dopr_norm_num = 7, dopts_num = 29, dots_max = 100
-
-    INTEGER ::  dots_num = 23
+    INTEGER(iwp), PARAMETER ::  dopr_norm_num = 7, dopts_num = 29, dots_max = 100
+
+    INTEGER(iwp) ::  dots_num = 23
 
     CHARACTER (LEN=6), DIMENSION(dopr_norm_num) ::  dopr_norm_names =   &
@@ -1306,41 +1120,41 @@
              'not_used        ' /)
 
-    INTEGER ::  id_dim_prtnum, id_dim_time_pr, id_dim_time_prt, &
-                id_dim_time_pts, id_dim_time_sp, id_dim_time_ts, id_dim_x_sp, &
-                id_dim_y_sp, id_dim_zu_sp, id_dim_zw_sp, id_set_pr, &
-                id_set_prt, id_set_pts, id_set_sp, id_set_ts, id_var_prtnum, &
-                id_var_rnop_prt, id_var_time_pr, id_var_time_prt, &
-                id_var_time_pts, id_var_time_sp, id_var_time_ts, id_var_x_sp, &
-                id_var_y_sp, id_var_zu_sp, id_var_zw_sp, nc_stat
-
-    INTEGER, DIMENSION(0:1) ::  id_dim_time_xy, id_dim_time_xz, &
-                id_dim_time_yz, id_dim_time_3d, id_dim_x_xy, id_dim_xu_xy, &
-                id_dim_x_xz, id_dim_xu_xz, id_dim_x_yz, id_dim_xu_yz, &
-                id_dim_x_3d, id_dim_xu_3d, id_dim_y_xy, id_dim_yv_xy, &
-                id_dim_y_xz, id_dim_yv_xz, id_dim_y_yz, id_dim_yv_yz, &
-                id_dim_y_3d, id_dim_yv_3d, id_dim_zu_xy, id_dim_zu1_xy, &
-                id_dim_zu_xz, id_dim_zu_yz, id_dim_zu_3d, id_dim_zw_xy, &
-                id_dim_zw_xz, id_dim_zw_yz, id_dim_zw_3d, id_set_xy, &
-                id_set_xz, id_set_yz, id_set_3d, id_var_ind_x_yz, &
-                id_var_ind_y_xz, id_var_ind_z_xy, id_var_time_xy, &
-                id_var_time_xz, id_var_time_yz, id_var_time_3d, id_var_x_xy, &
-                id_var_xu_xy, id_var_x_xz, id_var_xu_xz, id_var_x_yz, &
-                id_var_xu_yz, id_var_x_3d, id_var_xu_3d, id_var_y_xy, &
-                id_var_yv_xy, id_var_y_xz, id_var_yv_xz, id_var_y_yz, &
-                id_var_yv_yz, id_var_y_3d, id_var_yv_3d, id_var_zusi_xy, &
-                id_var_zusi_3d, id_var_zu_xy, id_var_zu1_xy, id_var_zu_xz, &
-                id_var_zu_yz, id_var_zu_3d, id_var_zwwi_xy, id_var_zwwi_3d, &
-                id_var_zw_xy, id_var_zw_xz, id_var_zw_yz, id_var_zw_3d
-
-    INTEGER, DIMENSION(10)  ::  id_var_dospx, id_var_dospy
-    INTEGER, DIMENSION(20)  ::  id_var_prt
-    INTEGER, DIMENSION(11)  ::  nc_precision
-    INTEGER, DIMENSION(dopr_norm_num) ::  id_var_norm_dopr
-
-    INTEGER, DIMENSION(dopts_num,0:10) ::  id_var_dopts
-    INTEGER, DIMENSION(0:1,100)        ::  id_var_do2d, id_var_do3d
-    INTEGER, DIMENSION(100,0:9)        ::  id_dim_z_pr, id_var_dopr, &
-                                           id_var_z_pr
-    INTEGER, DIMENSION(dots_max,0:9)   ::  id_var_dots
+    INTEGER(iwp) ::  id_dim_prtnum, id_dim_time_pr, id_dim_time_prt, &
+                     id_dim_time_pts, id_dim_time_sp, id_dim_time_ts, id_dim_x_sp, &
+                     id_dim_y_sp, id_dim_zu_sp, id_dim_zw_sp, id_set_pr, &
+                     id_set_prt, id_set_pts, id_set_sp, id_set_ts, id_var_prtnum, &
+                     id_var_rnop_prt, id_var_time_pr, id_var_time_prt, &
+                     id_var_time_pts, id_var_time_sp, id_var_time_ts, id_var_x_sp, &
+                     id_var_y_sp, id_var_zu_sp, id_var_zw_sp, nc_stat
+
+    INTEGER(iwp), DIMENSION(0:1) ::  id_dim_time_xy, id_dim_time_xz, &
+                    id_dim_time_yz, id_dim_time_3d, id_dim_x_xy, id_dim_xu_xy, &
+                    id_dim_x_xz, id_dim_xu_xz, id_dim_x_yz, id_dim_xu_yz, &
+                    id_dim_x_3d, id_dim_xu_3d, id_dim_y_xy, id_dim_yv_xy, &
+                    id_dim_y_xz, id_dim_yv_xz, id_dim_y_yz, id_dim_yv_yz, &
+                    id_dim_y_3d, id_dim_yv_3d, id_dim_zu_xy, id_dim_zu1_xy, &
+                    id_dim_zu_xz, id_dim_zu_yz, id_dim_zu_3d, id_dim_zw_xy, &
+                    id_dim_zw_xz, id_dim_zw_yz, id_dim_zw_3d, id_set_xy, &
+                    id_set_xz, id_set_yz, id_set_3d, id_var_ind_x_yz, &
+                    id_var_ind_y_xz, id_var_ind_z_xy, id_var_time_xy, &
+                    id_var_time_xz, id_var_time_yz, id_var_time_3d, id_var_x_xy, &
+                    id_var_xu_xy, id_var_x_xz, id_var_xu_xz, id_var_x_yz, &
+                    id_var_xu_yz, id_var_x_3d, id_var_xu_3d, id_var_y_xy, &
+                    id_var_yv_xy, id_var_y_xz, id_var_yv_xz, id_var_y_yz, &
+                    id_var_yv_yz, id_var_y_3d, id_var_yv_3d, id_var_zusi_xy, &
+                    id_var_zusi_3d, id_var_zu_xy, id_var_zu1_xy, id_var_zu_xz, &
+                    id_var_zu_yz, id_var_zu_3d, id_var_zwwi_xy, id_var_zwwi_3d, &
+                    id_var_zw_xy, id_var_zw_xz, id_var_zw_yz, id_var_zw_3d
+
+    INTEGER(iwp), DIMENSION(10)  ::  id_var_dospx, id_var_dospy
+    INTEGER(iwp), DIMENSION(20)  ::  id_var_prt
+    INTEGER(iwp), DIMENSION(11)  ::  nc_precision
+    INTEGER(iwp), DIMENSION(dopr_norm_num) ::  id_var_norm_dopr
+
+    INTEGER(iwp), DIMENSION(dopts_num,0:10) ::  id_var_dopts
+    INTEGER(iwp), DIMENSION(0:1,100)        ::  id_var_do2d, id_var_do3d
+    INTEGER(iwp), DIMENSION(100,0:9)        ::  id_dim_z_pr, id_var_dopr, &
+                                               id_var_z_pr
+    INTEGER(iwp), DIMENSION(dots_max,0:9)   ::  id_var_dots
 
 !
@@ -1350,13 +1164,13 @@
     LOGICAL ::  output_for_t0 = .FALSE.
 
-    INTEGER, DIMENSION(1:max_masks,0:1) ::  id_dim_time_mask, id_dim_x_mask, &
-                id_dim_xu_mask, id_dim_y_mask, id_dim_yv_mask, id_dim_zu_mask, &
-                id_dim_zw_mask, &
-                id_set_mask, &
-                id_var_time_mask, id_var_x_mask, id_var_xu_mask, &
-                id_var_y_mask, id_var_yv_mask, id_var_zu_mask, id_var_zw_mask, &
-                id_var_zusi_mask, id_var_zwwi_mask
-
-    INTEGER, DIMENSION(1:max_masks,0:1,100)         ::  id_var_domask
+    INTEGER(iwp), DIMENSION(1:max_masks,0:1) ::  id_dim_time_mask, id_dim_x_mask, &
+                   id_dim_xu_mask, id_dim_y_mask, id_dim_yv_mask, id_dim_zu_mask, &
+                   id_dim_zw_mask, &
+                   id_set_mask, &
+                   id_var_time_mask, id_var_x_mask, id_var_xu_mask, &
+                   id_var_y_mask, id_var_yv_mask, id_var_zu_mask, id_var_zw_mask, &
+                   id_var_zusi_mask, id_var_zwwi_mask
+
+    INTEGER(iwp), DIMENSION(1:max_masks,0:1,100)         ::  id_var_domask
 
     SAVE
@@ -1374,5 +1188,5 @@
 !------------------------------------------------------------------------------!
 
-    USE precision_kind
+    USE kinds
 
     CHARACTER (LEN=15)  ::  bc_par_lr = 'cyclic',  bc_par_ns = 'cyclic', &
@@ -1380,29 +1194,27 @@
                             collision_kernel = 'none'
 
-#if defined( __parallel )
-    INTEGER ::  mpi_particle_type
-#endif
-    INTEGER ::  deleted_particles = 0, deleted_tails = 0,                      &
-                dissipation_classes = 10, ibc_par_lr,                          &
-                ibc_par_ns, ibc_par_b, ibc_par_t, iran_part = -1234567,        &
-                maximum_number_of_particles = 1000,                            &
-                maximum_number_of_tailpoints = 100,                            &
-                maximum_number_of_tails = 0,                                   &
-                number_of_sublayers = 20,                                      &
-                number_of_initial_particles = 0, number_of_particles = 0,      &
-                number_of_particle_groups = 1, number_of_tails = 0,            &
-                number_of_initial_tails = 0, offset_ocean_nzt = 0,             &
-                offset_ocean_nzt_m1 = 0, particles_per_point = 1,              &
-                particle_file_count = 0, radius_classes = 20,                  &
-                skip_particles_for_tail = 100, sort_count = 0,                 &
-                total_number_of_particles, total_number_of_tails = 0,          &
-                trlp_count_sum, trlp_count_recv_sum, trrp_count_sum,           &
-                trrp_count_recv_sum, trsp_count_sum, trsp_count_recv_sum,      &
-                trnp_count_sum, trnp_count_recv_sum
-
-    INTEGER, PARAMETER ::  max_number_of_particle_groups = 10
-
-    INTEGER, DIMENSION(:), ALLOCATABLE     ::  new_tail_id
-    INTEGER, DIMENSION(:,:,:), ALLOCATABLE ::  prt_count, prt_start_index
+    INTEGER(iwp) ::  deleted_particles = 0, deleted_tails = 0,                      &
+                     dissipation_classes = 10, ibc_par_lr,                          &
+                     ibc_par_ns, ibc_par_b, ibc_par_t, iran_part = -1234567,        &
+                     maximum_number_of_particles = 1000,                            &
+                     maximum_number_of_tailpoints = 100,                            &
+                     maximum_number_of_tails = 0,                                   &
+                     mpi_particle_type,                                             &
+                     number_of_sublayers = 20,                                      &
+                     number_of_initial_particles = 0, number_of_particles = 0,      &
+                     number_of_particle_groups = 1, number_of_tails = 0,            &
+                     number_of_initial_tails = 0, offset_ocean_nzt = 0,             &
+                     offset_ocean_nzt_m1 = 0, particles_per_point = 1,              &
+                     particle_file_count = 0, radius_classes = 20,                  &
+                     skip_particles_for_tail = 100, sort_count = 0,                 &
+                     total_number_of_particles, total_number_of_tails = 0,          &
+                     trlp_count_sum, trlp_count_recv_sum, trrp_count_sum,           &
+                     trrp_count_recv_sum, trsp_count_sum, trsp_count_recv_sum,      &
+                     trnp_count_sum, trnp_count_recv_sum
+
+    INTEGER(iwp), PARAMETER ::  max_number_of_particle_groups = 10
+
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE     ::  new_tail_id
+    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  prt_count, prt_start_index
 
     LOGICAL ::  hall_kernel = .FALSE., palm_kernel = .FALSE.,                  &
@@ -1418,32 +1230,32 @@
     LOGICAL, DIMENSION(:), ALLOCATABLE ::  particle_mask, tail_mask
 
-    REAL    ::  c_0 = 3.0, dt_min_part = 0.0002, dt_prel = 9999999.9,          &
-                dt_sort_particles = 0.0, dt_write_particle_data = 9999999.9,   &
-                dvrp_psize = 9999999.9, end_time_prel = 9999999.9,             &
-                initial_weighting_factor = 1.0,                                &
-                maximum_tailpoint_age = 100000.0,                              &
-                minimum_tailpoint_distance = 0.0,                              &
-                particle_advection_start = 0.0, sgs_wfu_part = 0.3333333,      &
-                sgs_wfv_part = 0.3333333, sgs_wfw_part = 0.3333333,            &
-                time_prel = 0.0, time_sort_particles = 0.0,                    &
-                time_write_particle_data = 0.0, z0_av_global
-
-    REAL, DIMENSION(max_number_of_particle_groups) ::  &
-                density_ratio = 9999999.9, pdx = 9999999.9, pdy = 9999999.9, &
-                pdz = 9999999.9, psb = 9999999.9, psl = 9999999.9,           &
-                psn = 9999999.9, psr = 9999999.9, pss = 9999999.9,           &
-                pst = 9999999.9, radius = 9999999.9
-
-    REAL, DIMENSION(:), ALLOCATABLE     ::  log_z_z0 
-
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  particle_tail_coordinates
+    REAL(wp)    ::  c_0 = 3.0, dt_min_part = 0.0002, dt_prel = 9999999.9,          &
+                    dt_sort_particles = 0.0, dt_write_particle_data = 9999999.9,   &
+                    dvrp_psize = 9999999.9, end_time_prel = 9999999.9,             &
+                    initial_weighting_factor = 1.0,                                &
+                    maximum_tailpoint_age = 100000.0,                              &
+                    minimum_tailpoint_distance = 0.0,                              &
+                    particle_advection_start = 0.0, sgs_wfu_part = 0.3333333,      &
+                    sgs_wfv_part = 0.3333333, sgs_wfw_part = 0.3333333,            &
+                    time_prel = 0.0, time_sort_particles = 0.0,                    &
+                    time_write_particle_data = 0.0, z0_av_global
+
+    REAL(wp), DIMENSION(max_number_of_particle_groups) ::  &
+                    density_ratio = 9999999.9, pdx = 9999999.9, pdy = 9999999.9, &
+                    pdz = 9999999.9, psb = 9999999.9, psl = 9999999.9,           &
+                    psn = 9999999.9, psr = 9999999.9, pss = 9999999.9,           &
+                    pst = 9999999.9, radius = 9999999.9
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE     ::  log_z_z0 
+
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  particle_tail_coordinates
 
 
     TYPE particle_type
        SEQUENCE
-       REAL    ::  age, age_m, dt_sum, dvrp_psize, e_m, origin_x, origin_y, &
-                   origin_z, radius, rvar1, rvar2, rvar3, speed_x, speed_y, &
-                   speed_z, weight_factor, x, y, z
-       INTEGER ::  class, group, tailpoints, tail_id
+       REAL(wp)    ::  age, age_m, dt_sum, dvrp_psize, e_m, origin_x, origin_y, &
+                       origin_z, radius, rvar1, rvar2, rvar3, speed_x, speed_y, &
+                       speed_z, weight_factor, x, y, z
+       INTEGER(iwp) ::  class, group, tailpoints, tail_id
     END TYPE particle_type
 
@@ -1454,5 +1266,5 @@
     TYPE particle_groups_type
        SEQUENCE
-       REAL    ::  density_ratio, radius, exp_arg, exp_term
+       REAL(wp)    ::  density_ratio, radius, exp_arg, exp_term
     END TYPE particle_groups_type
 
@@ -1477,4 +1289,6 @@
 ! MPI-calls.
 !------------------------------------------------------------------------------!
+
+    USE kinds
 
 #if defined( __parallel ) && ! defined ( __check )
@@ -1487,20 +1301,20 @@
     CHARACTER(LEN=2) ::  send_receive = 'al'
     CHARACTER(LEN=5) ::  myid_char = ''
-    INTEGER          ::  acc_rank, comm1dx, comm1dy, comm2d, comm_inter,       &
-                         comm_palm, id_inflow = 0, id_recycling = 0, ierr,     &
-                         myid = 0, myidx = 0, myidy = 0, ndim = 2, ngp_a,      &
-                         ngp_o, ngp_xy, ngp_y, npex = -1, npey = -1,           &
-                         numprocs = 1, numprocs_previous_run = -1,             &
-                         num_acc_per_node = 0, pleft, pnorth, pright, psouth,  &
-                         req_count = 0, sendrecvcount_xy, sendrecvcount_yz,    &
-                         sendrecvcount_zx, sendrecvcount_zyd,                  &
-                         sendrecvcount_yxd, target_id, tasks_per_node = -9999, &
-                         threads_per_task = 1, type_x, type_x_int, type_xy,    &
-                         type_y, type_y_int
-
-    INTEGER          ::  pdims(2) = 1, req(100)
-
-    INTEGER, DIMENSION(:,:), ALLOCATABLE ::  hor_index_bounds, &
-                                             hor_index_bounds_previous_run
+    INTEGER(iwp)          ::  acc_rank, comm1dx, comm1dy, comm2d, comm_inter,       &
+                              comm_palm, id_inflow = 0, id_recycling = 0, ierr,     &
+                              myid = 0, myidx = 0, myidy = 0, ndim = 2, ngp_a,      &
+                              ngp_o, ngp_xy, ngp_y, npex = -1, npey = -1,           &
+                              numprocs = 1, numprocs_previous_run = -1,             &
+                              num_acc_per_node = 0, pleft, pnorth, pright, psouth,  &
+                              req_count = 0, sendrecvcount_xy, sendrecvcount_yz,    &
+                              sendrecvcount_zx, sendrecvcount_zyd,                  &
+                              sendrecvcount_yxd, target_id, tasks_per_node = -9999, &
+                              threads_per_task = 1, type_x, type_x_int, type_xy,    &
+                              type_y, type_y_int
+
+    INTEGER(iwp)          ::  pdims(2) = 1, req(100)
+
+    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  hor_index_bounds, &
+                                                  hor_index_bounds_previous_run
 
     LOGICAL ::  background_communication =.FALSE., collective_wait = .FALSE., &
@@ -1512,13 +1326,13 @@
 #endif
 
-    INTEGER ::  ibuf(12), pcoord(2)
+    INTEGER(iwp) ::  ibuf(12), pcoord(2)
 
 #if ! defined ( __check )
-    INTEGER ::  status(MPI_STATUS_SIZE)
-    INTEGER, DIMENSION(MPI_STATUS_SIZE,100) ::  wait_stat
+    INTEGER(iwp) ::  status(MPI_STATUS_SIZE)
+    INTEGER(iwp), DIMENSION(MPI_STATUS_SIZE,100) ::  wait_stat
 #endif
 
 
-    INTEGER, DIMENSION(:), ALLOCATABLE ::  ngp_yz, type_xz, type_yz
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ngp_yz, type_xz, type_yz
 
     LOGICAL ::  left_border_pe  = .FALSE., north_border_pe = .FALSE., &
@@ -1545,5 +1359,7 @@
 !------------------------------------------------------------------------------!
 
-    INTEGER, PARAMETER ::  crmax = 100
+    USE kinds
+
+    INTEGER(iwp), PARAMETER ::  crmax = 100
 
     CHARACTER (LEN=20), DIMENSION(20) ::  cross_ts_profiles = &
@@ -1565,24 +1381,24 @@
                          ( '                               ', i9 = 1, 94 ) /)
 
-    INTEGER ::  profile_columns = 2, profile_rows = 3, profile_number = 0
-
-    INTEGER ::  cross_ts_numbers(crmax,crmax) = 0, &
-                cross_ts_number_count(crmax) = 0, &
-                dopr_index(300) = 0, dopr_initial_index(300) = 0, &
-                dots_crossindex(100) = 0, dots_index(100) = 0
+    INTEGER(iwp) ::  profile_columns = 2, profile_rows = 3, profile_number = 0
+
+    INTEGER(iwp) ::  cross_ts_numbers(crmax,crmax) = 0, &
+                     cross_ts_number_count(crmax) = 0, &
+                     dopr_index(300) = 0, dopr_initial_index(300) = 0, &
+                     dots_crossindex(100) = 0, dots_index(100) = 0
                 
 
-    REAL ::  cross_ts_uymax(20) = &
+    REAL(wp) ::  cross_ts_uymax(20) = &
                              (/ 999.999, 999.999, 999.999, 999.999, 999.999,   &
                                 999.999, 999.999, 999.999, 999.999, 999.999,   &
                                 999.999, 999.999, 999.999, 999.999, 999.999,   &
                                 999.999, 999.999, 999.999, 999.999, 999.999 /),&
-             cross_ts_uymax_computed(20) = 999.999, &
-             cross_ts_uymin(20) = &
+                 cross_ts_uymax_computed(20) = 999.999, &
+                 cross_ts_uymin(20) = &
                              (/ 999.999, 999.999, 999.999,  -5.000, 999.999,   &
                                 999.999,   0.000, 999.999, 999.999, 999.999,   &
                                 999.999, 999.999, 999.999, 999.999, 999.999,   &
                                 999.999, 999.999, 999.999, 999.999, 999.999 /),&
-             cross_ts_uymin_computed(20) = 999.999
+                 cross_ts_uymin_computed(20) = 999.999
 
     SAVE
@@ -1600,4 +1416,6 @@
 ! Definition of quantities used for computing spectra
 !------------------------------------------------------------------------------!
+
+    USE kinds
 
     CHARACTER (LEN=6),  DIMENSION(1:5) ::  header_char = (/ 'PS(u) ', 'PS(v) ',&
@@ -1618,20 +1436,20 @@
                                     'k ^2236 ^2566^2569<q(k) in m>2s>->2    ' /)
 
-    INTEGER ::  klist_x = 0, klist_y = 0, n_sp_x = 0, n_sp_y = 0
-
-    INTEGER ::  comp_spectra_level(100) = 999999,                   &
-                lstyles(100) = (/ 0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
-                                  0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
-                                  0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
-                                  0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
-                                  0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
-                                  0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
-                                  0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
-                                  0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
-                                  0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
-                                  0, 7, 3, 10, 1, 4, 9, 2, 6, 8 /), &
-                plot_spectra_level(100) = 999999
-
-    REAL    ::  time_to_start_sp = 0.0
+    INTEGER(iwp) ::  klist_x = 0, klist_y = 0, n_sp_x = 0, n_sp_y = 0
+
+    INTEGER(iwp) ::  comp_spectra_level(100) = 999999,                   &
+                     lstyles(100) = (/ 0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
+                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
+                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
+                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
+                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
+                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
+                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
+                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
+                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
+                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8 /), &
+                     plot_spectra_level(100) = 999999
+
+    REAL(wp)    ::  time_to_start_sp = 0.0
 
     SAVE
@@ -1650,25 +1468,27 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+
     CHARACTER (LEN=40) ::  region(0:9)
-    INTEGER ::  pr_palm = 90, statistic_regions = 0
-    INTEGER ::  u_max_ijk(3) = -1, v_max_ijk(3) = -1, w_max_ijk(3) = -1
+    INTEGER(iwp) ::  pr_palm = 90, statistic_regions = 0
+    INTEGER(iwp) ::  u_max_ijk(3) = -1, v_max_ijk(3) = -1, w_max_ijk(3) = -1
     LOGICAL ::  flow_statistics_called = .FALSE.
-    REAL ::     u_max, v_max, w_max
-    REAL, DIMENSION(:), ALLOCATABLE       ::  sums_divnew_l, sums_divold_l,   &
-                                              weight_substep, weight_pres
-    REAL, DIMENSION(:,:), ALLOCATABLE     ::  sums, sums_wsts_bc_l, ts_value, &
-                                              sums_wsus_ws_l, sums_wsvs_ws_l, &
-                                              sums_us2_ws_l, sums_vs2_ws_l,   &
-                                              sums_ws2_ws_l,                  &
-                                              sums_wsnrs_ws_l,                &
-                                              sums_wspts_ws_l,                &
-                                              sums_wssas_ws_l,                &
-                                              sums_wsqs_ws_l,                 &
-                                              sums_wsqrs_ws_l
+    REAL(wp) ::     u_max, v_max, w_max
+    REAL(wp), DIMENSION(:), ALLOCATABLE       ::  sums_divnew_l, sums_divold_l,   &
+                                                  weight_substep, weight_pres
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE     ::  sums, sums_wsts_bc_l, ts_value, &
+                                                  sums_wsus_ws_l, sums_wsvs_ws_l, &
+                                                  sums_us2_ws_l, sums_vs2_ws_l,   &
+                                                  sums_ws2_ws_l,                  &
+                                                  sums_wsnrs_ws_l,                &
+                                                  sums_wspts_ws_l,                &
+                                                  sums_wssas_ws_l,                &
+                                                  sums_wsqs_ws_l,                 &
+                                                  sums_wsqrs_ws_l
                                               
-    REAL, DIMENSION(:,:,:), ALLOCATABLE   ::  hom_sum, rmask, spectrum_x, &
-                                              spectrum_y, sums_l, sums_l_l, &
-                                              sums_up_fraction_l
-    REAL, DIMENSION(:,:,:,:), ALLOCATABLE ::  hom
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  hom_sum, rmask, spectrum_x, &
+                                                  spectrum_y, sums_l, sums_l_l, &
+                                                  sums_up_fraction_l
+    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  hom
 
     SAVE
@@ -1687,6 +1507,8 @@
 !------------------------------------------------------------------------------!
 
-    INTEGER ::  nxl_y, nxl_yd, nxl_z, nxr_y, nxr_yd, nxr_z, nyn_x, nyn_z,      &
-                nys_x, nys_z, nzb_x, nzb_y, nzb_yd, nzt_x, nzt_y, nzt_yd
+    USE kinds
+
+    INTEGER(iwp) ::  nxl_y, nxl_yd, nxl_z, nxr_y, nxr_yd, nxr_z, nyn_x, nyn_z,      &
+                     nys_x, nys_z, nzb_x, nzb_y, nzb_yd, nzt_x, nzt_y, nzt_yd
                 
 
Index: /palm/trunk/SOURCE/netcdf.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf.f90	(revision 1319)
+++ /palm/trunk/SOURCE/netcdf.f90	(revision 1320)
@@ -23,5 +23,10 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -70,62 +75,4 @@
 ! cross_profiles, profile_rows, profile_columns are written to netCDF header
 !
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt
-!
-! 600 2010-11-24 16:10:51Z raasch
-! bugfix concerning check of cross-section levels on netcdf-files to be
-! extended (xz,yz)
-!
-! 564 2010-09-30 13:18:59Z helmke
-! nc_precision changed from 40 masks to 1 mask, start number of mask output
-! files changed to 201, netcdf message identifiers of masked output changed 
-!
-! 519 2010-03-19 05:30:02Z raasch
-! particle number defined as unlimited dimension in case of netCDF4 output,
-! special characters like * and " are now allowed for netCDF variable names,
-! replacement of these characters removed, routine clean_netcdf_varname
-! removed
-!
-! 493 2010-03-01 08:30:24Z raasch
-! Extensions for netCDF4 output
-!
-! 410 2009-12-04 17:05:40Z letzel
-! masked data output
-!
-! 359 2009-08-19 16:56:44Z letzel
-! for extended netCDF files, the updated title attribute includes an update of
-! time_average_text where appropriate.
-! Bugfix for extended netCDF files: In order to avoid 'data mode' errors if
-! updated attributes are larger than their original size, NF90_PUT_ATT is called
-! in 'define mode' enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a
-! possible performance loss; an alternative strategy would be to ensure equal
-! attribute size in a job chain.
-! netCDF unit attribute in timeseries output in case of statistic
-! regions added.
-! Output of netCDF messages with aid of message handling routine.
-! Output of messages replaced by message handling routine.
-! Typographical errors fixed.
-!
-! 216 2008-11-25 07:12:43Z raasch
-! Origin of the xy-coordinate system shifted from the center of the first
-! grid cell (indices i=0, j=0) to the south-left corner of this cell.
-!
-! 189 2008-08-13 17:09:26Z letzel
-! consistently allow 100 spectra levels instead of 10
-! bug fix in the determination of the number of output heights for spectra,
-! +user-defined spectra
-!
-! 97 2007-06-21 08:23:15Z raasch
-! Grids defined for rho and sa
-!
-! 48 2007-03-06 12:28:36Z raasch
-! Output topography height information (zu_s_inner, zw_s_inner) to 2d-xy and 3d
-! datasets
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.12  2006/09/26 19:35:16  raasch
-! Bugfix yv coordinates for yz cross sections
-!
 ! Revision 1.1  2005/05/18 15:37:16  raasch
 ! Initial revision
@@ -149,54 +96,107 @@
 #if defined( __netcdf )
 
-    USE arrays_3d
-    USE constants
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                              &
+        ONLY:  zu, zw
+
+    USE constants,                                                              &
+        ONLY:  pi
+
+    USE control_parameters,                                                     &
+        ONLY:  averaging_interval, averaging_interval_pr, averaging_interval_sp,&
+        data_output_pr,  domask,  dopr_n,dopr_time_count, dopts_time_count,     &
+        dots_time_count, dosp_time_count, do2d, do2d_xz_time_count, do3d,       &
+        do2d_yz_time_count, mask_size, do2d_xy_time_count, do3d_time_count,     &
+        domask_time_count, mask_i_global, mask_j_global,mask_k_global,          &
+        message_string, mid, netcdf_data_format, netcdf_precision, ntdim_2d_xy, &
+        ntdim_2d_xz, ntdim_2d_yz, ntdim_3d, nz_do3d, prt_time_count,            &
+        run_description_header, section, simulated_time, topography
+
+    USE grid_variables,                                                         &
+        ONLY:  dx, dy, zu_s_inner, zw_w_inner
+
+    USE indices,                                                                &
+        ONLY:  nx, ny, nz ,nzb, nzt
+
     USE netcdf_control
+
+    USE kinds
+
     USE pegrid
-    USE particle_attributes
-    USE profil_parameter
-    USE spectrum
-    USE statistics
+
+    USE particle_attributes,                                                    &
+        ONLY:  maximum_number_of_particles, number_of_particle_groups
+
+    USE profil_parameter,                                                       &
+        ONLY:  crmax, cross_profiles, dopr_index,profile_columns, profile_rows
+
+    USE spectrum,                                                               &
+        ONLY:  comp_spectra_level, data_output_sp, spectra_direction
+
+    USE statistics,                                                             &
+        ONLY:  hom, statistic_regions
 
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=2)              ::  suffix
-    CHARACTER (LEN=2), INTENT (IN) ::  callmode
-    CHARACTER (LEN=3)              ::  suffix1
-    CHARACTER (LEN=4)              ::  grid_x, grid_y, grid_z
-    CHARACTER (LEN=6)              ::  mode
-    CHARACTER (LEN=10)             ::  netcdf_var_name, precision, var
-    CHARACTER (LEN=80)             ::  time_average_text
-    CHARACTER (LEN=2000)           ::  char_cross_profiles, var_list, var_list_old
-
-    CHARACTER (LEN=100), DIMENSION(1:crmax) ::  cross_profiles_adj,   &
-                                                cross_profiles_char
-
-    INTEGER ::  av, cross_profiles_count, cross_profiles_maxi, delim, &
-                delim_old, file_id, i, id_last, id_x, id_y, id_z, j,  &
-                k, kk, ns, ns_old, ntime_count, nz_old
-
-    INTEGER, SAVE ::  oldmode
-
-    INTEGER, DIMENSION(1) ::  id_dim_time_old, id_dim_x_yz_old,  &
-                              id_dim_y_xz_old, id_dim_zu_sp_old, &
-                              id_dim_zu_xy_old, id_dim_zu_3d_old, &
-                              id_dim_zu_mask_old
-
-    INTEGER, DIMENSION(1:crmax) ::  cross_profiles_numb
-
-    LOGICAL ::  found
-
-    LOGICAL, INTENT (INOUT) ::  extend
-
-    LOGICAL, SAVE ::  init_netcdf = .FALSE.
-
-    REAL, DIMENSION(1) ::  last_time_coordinate
-
-    REAL, DIMENSION(:), ALLOCATABLE   ::  netcdf_data
-    REAL, DIMENSION(:,:), ALLOCATABLE ::  netcdf_data_2d
+    CHARACTER (LEN=2)              ::  suffix                !:
+    CHARACTER (LEN=2), INTENT (IN) ::  callmode              !:
+    CHARACTER (LEN=3)              ::  suffix1               !:
+    CHARACTER (LEN=4)              ::  grid_x                !:
+    CHARACTER (LEN=4)              ::  grid_y                !:
+    CHARACTER (LEN=4)              ::  grid_z                !:
+    CHARACTER (LEN=6)              ::  mode                  !:
+    CHARACTER (LEN=10)             ::  netcdf_var_name       !:
+    CHARACTER (LEN=10)             ::  precision             !:
+    CHARACTER (LEN=10)             ::  var                   !:
+    CHARACTER (LEN=80)             ::  time_average_text     !:
+    CHARACTER (LEN=2000)           ::  char_cross_profiles   !:
+    CHARACTER (LEN=2000)           ::  var_list              !:
+    CHARACTER (LEN=2000)           ::  var_list_old          !:
+
+    CHARACTER (LEN=100), DIMENSION(1:crmax) ::  cross_profiles_adj   !:
+    CHARACTER (LEN=100), DIMENSION(1:crmax) ::  cross_profiles_char  !:
+
+    INTEGER(iwp) ::  av                                      !:
+    INTEGER(iwp) ::  cross_profiles_count                    !:
+    INTEGER(iwp) ::  cross_profiles_maxi                     !:
+    INTEGER(iwp) ::  delim                                   !:
+    INTEGER(iwp) ::  delim_old                               !:
+    INTEGER(iwp) ::  file_id                                 !:
+    INTEGER(iwp) ::  i                                       !:
+    INTEGER(iwp) ::  id_last                                 !:
+    INTEGER(iwp) ::  id_x                                    !:
+    INTEGER(iwp) ::  id_y                                    !:
+    INTEGER(iwp) ::  id_z                                    !:
+    INTEGER(iwp) ::  j                                       !:
+    INTEGER(iwp) ::  k                                       !:
+    INTEGER(iwp) ::  kk                                      !:
+    INTEGER(iwp) ::  ns                                      !:
+    INTEGER(iwp) ::  ns_old                                  !:
+    INTEGER(iwp) ::  ntime_count                             !:
+    INTEGER(iwp) ::  nz_old                                  !:
+
+    INTEGER(iwp), SAVE ::  oldmode                           !:
+
+    INTEGER(iwp), DIMENSION(1) ::  id_dim_time_old           !:
+    INTEGER(iwp), DIMENSION(1) ::  id_dim_x_yz_old           !:
+    INTEGER(iwp), DIMENSION(1) ::  id_dim_y_xz_old           !:
+    INTEGER(iwp), DIMENSION(1) ::  id_dim_zu_sp_old          !:
+    INTEGER(iwp), DIMENSION(1) ::  id_dim_zu_xy_old          !:
+    INTEGER(iwp), DIMENSION(1) ::  id_dim_zu_3d_old          !:
+    INTEGER(iwp), DIMENSION(1) ::  id_dim_zu_mask_old        !:
+
+
+    INTEGER(iwp), DIMENSION(1:crmax) ::  cross_profiles_numb !:
+
+    LOGICAL ::  found                                        !:
+
+    LOGICAL, INTENT (INOUT) ::  extend                       !:
+
+    LOGICAL, SAVE ::  init_netcdf = .FALSE.                  !:
+
+    REAL(wp), DIMENSION(1) ::  last_time_coordinate          !:
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE   ::  netcdf_data    !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  netcdf_data_2d !:
 
 !
@@ -4969,5 +4969,5 @@
     CHARACTER(LEN=*) ::  routine_name
 
-    INTEGER ::  errno
+    INTEGER(iwp) ::  errno
 
     IF ( nc_stat /= NF90_NOERR )  THEN
Index: /palm/trunk/SOURCE/nudging.f90
===================================================================
--- /palm/trunk/SOURCE/nudging.f90	(revision 1319)
+++ /palm/trunk/SOURCE/nudging.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -62,20 +68,44 @@
     SUBROUTINE init_nudge
 
-       USE arrays_3d
-       USE control_parameters
-       USE cpulog
-       USE indices
-       USE pegrid
+       USE arrays_3d,                                                          &
+           ONLY:  ptnudge, qnudge, timenudge, tnudge, unudge, vnudge, wnudge,  &
+                  zu
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_3d, lptnudge, lqnudge, lunudge, lvnudge, lwnudge,         &
+                   message_string, ntnudge
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzt
+
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER :: finput = 90, ierrn, k, t 
-
-       CHARACTER(1) :: hash
-       REAL :: highheight, highqnudge, highptnudge, highunudge, highvnudge, &
-               highwnudge, hightnudge
-       REAL :: lowheight, lowqnudge, lowptnudge, lowunudge, lowvnudge, &
-               lowwnudge, lowtnudge
-       REAL :: fac
+
+       INTEGER(iwp) ::  finput = 90  !:
+       INTEGER(iwp) ::  ierrn        !:
+       INTEGER(iwp) ::  k            !:
+       INTEGER(iwp) ::  t            !:
+
+       CHARACTER(1) ::  hash     !:
+
+       REAL(wp) ::  highheight   !:
+       REAL(wp) ::  highqnudge   !:
+       REAL(wp) ::  highptnudge  !:
+       REAL(wp) ::  highunudge   !:
+       REAL(wp) ::  highvnudge   !:
+       REAL(wp) ::  highwnudge   !:
+       REAL(wp) ::  hightnudge   !:
+
+       REAL(wp) ::  lowheight    !:
+       REAL(wp) ::  lowqnudge    !:
+       REAL(wp) ::  lowptnudge   !:
+       REAL(wp) ::  lowunudge    !:
+       REAL(wp) ::  lowvnudge    !:
+       REAL(wp) ::  lowwnudge    !:
+       REAL(wp) ::  lowtnudge    !:
+
+       REAL(wp) ::  fac          !:
 
        ALLOCATE( ptnudge(nzb:nzt+1,1:ntnudge), qnudge(nzb:nzt+1,1:ntnudge), &
@@ -103,5 +133,5 @@
           t = t + 1
           hash = "#"
-          ierrn = 1 ! not zero        
+          ierrn = 1 ! not zero
 !
 !--       Search for the next line consisting of "# time", 
@@ -160,10 +190,10 @@
              fac = ( highheight - zu(k) ) / ( highheight - lowheight )
 
-             tnudge(k,t)  = fac * lowtnudge + ( 1 - fac ) * hightnudge
-             unudge(k,t)  = fac * lowunudge + ( 1 - fac ) * highunudge
-             vnudge(k,t)  = fac * lowvnudge + ( 1 - fac ) * highvnudge
-             wnudge(k,t)  = fac * lowwnudge + ( 1 - fac ) * highwnudge
-             ptnudge(k,t) = fac * lowptnudge + ( 1 - fac ) * highptnudge
-             qnudge(k,t)  = fac * lowqnudge + ( 1 - fac ) * highqnudge
+             tnudge(k,t)  = fac * lowtnudge + ( 1.0 - fac ) * hightnudge
+             unudge(k,t)  = fac * lowunudge + ( 1.0 - fac ) * highunudge
+             vnudge(k,t)  = fac * lowvnudge + ( 1.0 - fac ) * highvnudge
+             wnudge(k,t)  = fac * lowwnudge + ( 1.0 - fac ) * highwnudge
+             ptnudge(k,t) = fac * lowptnudge + ( 1.0 - fac ) * highptnudge
+             qnudge(k,t)  = fac * lowqnudge + ( 1.0 - fac ) * highqnudge
           ENDDO
 
@@ -188,19 +218,36 @@
     SUBROUTINE nudge ( time, prog_var )
 
-       USE arrays_3d
-       USE buoyancy_mod
-       USE control_parameters
-       USE cpulog
-       USE indices
-       USE pegrid
-       USE statistics 
+       USE arrays_3d,                                                          &
+           ONLY:  pt, ptnudge, q, qnudge, tend, timenudge, tnudge, u, unudge,  &
+                  v, vnudge
+
+       USE buoyancy_mod,                                                       &
+           ONLY:  calc_mean_profile
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_3d, message_string
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nys, nyn, nzb, nzb_u_inner, nzt
+
+       USE kinds,                                                              &
+           ONLY:  iwp, wp
+
+       USE statistics,                                                         &
+           ONLY:  hom
 
        IMPLICIT NONE
 
-       CHARACTER (LEN=*) ::  prog_var
-
-       REAL :: currtnudge, dtm, dtp, time
-
-       INTEGER ::  i, j, k, t
+       CHARACTER (LEN=*) ::  prog_var  !:
+
+       REAL(wp) ::  currtnudge  !:
+       REAL(wp) ::  dtm         !:
+       REAL(wp) ::  dtp         !:
+       REAL(wp) ::  time        !:
+
+       INTEGER(iwp) ::  i  !:
+       INTEGER(iwp) ::  j  !:
+       INTEGER(iwp) ::  k  !:
+       INTEGER(iwp) ::  t  !:
 
 
@@ -309,19 +356,37 @@
     SUBROUTINE nudge_ij( i, j, time, prog_var )
 
-       USE arrays_3d
-       USE buoyancy_mod
-       USE control_parameters
-       USE cpulog
-       USE indices
-       USE pegrid
-       USE statistics 
+       USE arrays_3d,                                                          &
+           ONLY:  pt, ptnudge, q, qnudge, tend, timenudge, tnudge, u, unudge,  &
+                  v, vnudge
+
+       USE buoyancy_mod,                                                       &
+           ONLY:  calc_mean_profile
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_3d, message_string
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nys, nyn, nzb, nzb_u_inner, nzt
+
+       USE kinds,                                                              &
+           ONLY:  iwp, wp
+
+       USE statistics,                                                         &
+           ONLY:  hom
 
        IMPLICIT NONE
 
-       CHARACTER (LEN=*) ::  prog_var
-
-       REAL :: currtnudge, dtm, dtp, time
-
-       INTEGER ::  i, j, k, t
+
+       CHARACTER (LEN=*) ::  prog_var  !:
+
+       REAL(wp) ::  currtnudge  !:
+       REAL(wp) ::  dtm         !:
+       REAL(wp) ::  dtp         !:
+       REAL(wp) ::  time        !:
+
+       INTEGER(iwp) ::  i  !:
+       INTEGER(iwp) ::  j  !:
+       INTEGER(iwp) ::  k  !:
+       INTEGER(iwp) ::  t  !:
 
 
Index: /palm/trunk/SOURCE/package_parin.f90
===================================================================
--- /palm/trunk/SOURCE/package_parin.f90	(revision 1319)
+++ /palm/trunk/SOURCE/package_parin.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -36,29 +42,4 @@
 ! replaced by collision_kernel
 !
-! 790 2011-11-29 03:11:20Z raasch
-! +turbulence_effects_on_collision, wang_collision_kernel in particles_par
-!
-! 336 2009-06-10 11:19:35Z raasch
-! +clip_dvrp_*, cluster_size, color_interval, dvrpsize_interval,
-! groundplate_color, isosurface_color, particle_color, particle_dvrpsize
-! topography_color, in dvrp_graphics_par,
-! parameter dvrp_psize moved from particles_par to dvrp_graphics_par
-! Variables for dvrp-mode pathlines added
-!
-! 210 2008-11-06 08:54:02Z raasch
-! Variables for dvrp-mode pathlines added
-!
-! 116 2007-10-11 02:30:27Z raasch
-! +dt_sort_particles in package_parin
-!
-! 60 2007-03-11 11:50:04Z raasch
-! Particles-package is now part of the default code
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.18  2006/08/04 14:52:23  raasch
-! +dt_dopts, dt_min_part, end_time_prel, particles_per_point,
-! use_sgs_for_particles in particles_par
-!
 ! Revision 1.1  2000/12/28 13:21:57  raasch
 ! Initial revision
@@ -71,12 +52,44 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE dvrp_variables
-    USE particle_attributes
-    USE spectrum
+    USE control_parameters,                                                    &
+        ONLY:  averaging_interval_sp, dt_dopts, dt_dosp, dt_dvrp,              &
+                particle_maximum_age, skip_time_dosp, threshold
+
+    USE dvrp_variables,                                                        &
+        ONLY:  clip_dvrp_l, clip_dvrp_n, clip_dvrp_r, clip_dvrp_s,             &
+               cluster_size, color_interval, dvrpsize_interval,                &
+               dvrp_directory, dvrp_file, dvrp_host, dvrp_output,              &
+               dvrp_password, dvrp_username, groundplate_color,                &
+               isosurface_color, mode_dvrp, particle_color,                    &
+               particle_dvrpsize, pathlines_fadeintime,                        &
+               pathlines_fadeouttime, pathlines_linecount,                     &
+               pathlines_maxhistory, pathlines_wavecount,                      &
+               pathlines_wavetime, slicer_range_limits_dvrp, superelevation,   &
+               superelevation_x, superelevation_y, topography_color,           &
+               vc_alpha, vc_gradient_normals, vc_mode, vc_size_x, vc_size_y,   &
+               vc_size_z
+
+    USE particle_attributes,                                                   &
+        ONLY:  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, collision_kernel,     &
+               density_ratio, dissipation_classes, dt_min_part, dt_prel,       &
+               dt_sort_particles, dt_write_particle_data, dvrp_psize,          &
+               end_time_prel, initial_weighting_factor,                        &
+               maximum_number_of_particles, maximum_number_of_tailpoints,      &
+               maximum_tailpoint_age, minimum_tailpoint_distance,              &
+               number_of_particle_groups, particles_per_point,                 &
+               particle_advection, particle_advection_start, pdx, pdy, pdz,    &
+               psb, psl, psn, psr, pss, pst, radius, radius_classes,           &
+               random_start_position, read_particles_from_restartfile,         &
+               skip_particles_for_tail, use_particle_tails,                    &
+               use_sgs_for_particles, vertical_particle_advection,             &
+               write_particle_statistics
+
+    USE spectrum,                                                              &
+        ONLY:  comp_spectra_level, data_output_sp, plot_spectra_level,         &
+               spectra_direction
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=80) ::  zeile
+    CHARACTER (LEN=80) ::  line  !:
 
     NAMELIST /dvrp_graphics_par/  clip_dvrp_l, clip_dvrp_n, clip_dvrp_r,       &
@@ -117,4 +130,5 @@
                                   vertical_particle_advection,                 &
                                   write_particle_statistics
+
     NAMELIST /spectra_par/        averaging_interval_sp, comp_spectra_level,   &
                                   data_output_sp, dt_dosp, plot_spectra_level, &
@@ -125,11 +139,11 @@
 !-- parin), search for the namelist-group of the package and position the
 !-- file at this line. Do the same for each optionally used package.
-    zeile = ' '
+    line = ' '
 
 #if defined( __dvrp_graphics )
     REWIND ( 11 )
-    zeile = ' '
-    DO   WHILE ( INDEX( zeile, '&dvrp_graphics_par' ) == 0 )
-       READ ( 11, '(A)', END=10 )  zeile
+    line = ' '
+    DO   WHILE ( INDEX( line, '&dvrp_graphics_par' ) == 0 )
+       READ ( 11, '(A)', END=10 )  line
     ENDDO
     BACKSPACE ( 11 )
@@ -145,7 +159,7 @@
 !-- Try to find particles package
     REWIND ( 11 )
-    zeile = ' '
-    DO   WHILE ( INDEX( zeile, '&particles_par' ) == 0 )
-       READ ( 11, '(A)', END=20 )  zeile
+    line = ' '
+    DO   WHILE ( INDEX( line, '&particles_par' ) == 0 )
+       READ ( 11, '(A)', END=20 )  line
     ENDDO
     BACKSPACE ( 11 )
@@ -164,7 +178,7 @@
 #if defined( __spectra )
     REWIND ( 11 )
-    zeile = ' '
-    DO   WHILE ( INDEX( zeile, '&spectra_par' ) == 0 )
-       READ ( 11, '(A)', END=30 )  zeile
+    line = ' '
+    DO   WHILE ( INDEX( line, '&spectra_par' ) == 0 )
+       READ ( 11, '(A)', END=30 )  line
     ENDDO
     BACKSPACE ( 11 )
Index: /palm/trunk/SOURCE/palm.f90
===================================================================
--- /palm/trunk/SOURCE/palm.f90	(revision 1319)
+++ /palm/trunk/SOURCE/palm.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -59,37 +65,4 @@
 ! 849 2012-03-15 10:35:09Z raasch
 ! write_particles renamed lpm_write_restart_file
-!
-! 759 2011-09-15 13:58:31Z raasch
-! Splitting of parallel I/O, cpu measurement for write_3d_binary and opening
-! of unit 14 moved to here
-!
-! 495 2010-03-02 00:40:15Z raasch
-! Particle data for restart runs are only written if write_binary=.T..
-!
-! 215 2008-11-18 09:54:31Z raasch
-! Initialization of coupled runs modified for MPI-1 and moved to external
-! subroutine init_coupling
-!
-! 197 2008-09-16 15:29:03Z raasch
-! Workaround for getting information about the coupling mode
-!
-! 108 2007-08-24 15:10:38Z letzel
-! Get coupling mode from environment variable, change location of debug output
-!
-! 75 2007-03-22 09:54:05Z raasch
-! __vtk directives removed, write_particles is called only in case of particle
-! advection switched on, open unit 9 for debug output,
-! setting of palm version moved from modules to here
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.10  2006/08/04 14:53:12  raasch
-! Distibution of run description header removed, call of header moved behind
-! init_3d_model
-!
-! Revision 1.2  2001/01/25 07:15:06  raasch
-! Program name changed to PALM, module test_variables removed.
-! Initialization of dvrp logging as well as exit of dvrp moved to new
-! subroutines init_dvrp_logging and close_dvrp (file init_dvrp.f90)
 !
 ! Revision 1.1  1997/07/24 11:23:35  raasch
@@ -108,18 +81,24 @@
 
 
-    USE arrays_3d
-    USE constants
-    USE control_parameters
-    USE cpulog
-    USE dvrp_variables
-    USE grid_variables
-    USE indices
-    USE ls_forcing_mod
-    USE model_1d
-    USE nudge_mod
-    USE particle_attributes
+    USE control_parameters,                                                    &
+        ONLY:  coupling_char, coupling_mode, do2d_at_begin, do3d_at_begin,     &
+               io_blocks, io_group, large_scale_forcing, nudging,              &
+               simulated_time, simulated_time_chr, version, write_binary
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point, cpu_statistics
+
+    USE kinds
+
+    USE ls_forcing_mod,                                                        &
+        ONLY:  init_ls_forcing
+
+    USE nudge_mod,                                                             &
+        ONLY:  init_nudge
+
+    USE particle_attributes,                                                   &
+        ONLY:  particle_advection
+
     USE pegrid
-    USE spectrum
-    USE statistics
 
 #if defined( __openacc )
@@ -131,8 +110,8 @@
 !
 !-- Local variables
-    CHARACTER (LEN=9) ::  time_to_string
-    INTEGER           ::  i
+    CHARACTER(LEN=9) ::  time_to_string  !:
+    INTEGER(iwp)     ::  i               !:
 #if defined( __openacc )
-    REAL, DIMENSION(100) ::  acc_dum
+    REAL(wp), DIMENSION(100) ::  acc_dum     !:
 #endif
 
Index: /palm/trunk/SOURCE/parin.f90
===================================================================
--- /palm/trunk/SOURCE/parin.f90	(revision 1319)
+++ /palm/trunk/SOURCE/parin.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -107,99 +113,4 @@
 ! New cpp directive "__check" implemented which is used by check_namelist_files
 !
-! 785 2011-11-28 09:47:19Z raasch
-! +scalar_rayleigh_damping in inipar
-!
-! 767 2011-10-14 06:39:12Z raasch
-! +u_profile, v_profile, uv_heights in inipar
-!
-! 759 2011-09-15 13:58:31Z raasch
-! +maximum_parallel_io_streams in envpar,
-! splitting of parallel I/O in blocks of PEs
-!
-! 683 2011-02-09 14:25:15Z raasch
-! +synchronous_exchange in d3par
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Steering parameter dissipation_control added in inipar. (commented out)
-!
-! 622 2010-12-10 08:08:13Z raasch
-! +collective_wait in inipar
-!
-! 600 2010-11-24 16:10:51Z raasch
-! parameters moved from d3par to inipar: call_psolver_at_all_substeps,
-! cfl_factor, cycle_mg, mg_cycles, mg_switch_to_pe0_level, ngsrb, nsor,
-! omega_sor, prandtl_number, psolver, rayleigh_damping_factor,
-! rayleigh_damping_height, residual_limit
-!
-! 580 2010-10-05 13:59:11Z heinze
-! Renaming of ws_vertical_gradient to subs_vertical_gradient and
-! ws_vertical_gradient_level to subs_vertical_gradient_level
-!
-! 553 2010-09-01 14:09:06Z weinreis
-! parameters for masked output are replaced by arrays
-!
-! 493 2010-03-01 08:30:24Z raasch
-! +netcdf_data_format in d3par, -netcdf_64bit, -netcdf_64bit_3d
-!
-! 449 2010-02-02 11:23:59Z raasch
-! +wall_humidityflux, wall_scalarflux
-! +ws_vertical_gradient, ws_vertical_gradient_level
-!
-! 410 2009-12-04 17:05:40Z letzel
-! masked data output: + dt_domask, mask_01~20_x|y|z, mask_01~20_x|y|z_loop, 
-! mask_scale_x|y|z, masks, skip_time_domask
-!
-! 291 2009-04-16 12:07:26Z raasch
-! +local_dvrserver_running in envpar
-! Output of messages replaced by message handling routine.
-! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
-! canyon_wall_south, conserve_volume_flow_mode, coupling_start_time,
-! dp_external, dp_level_b, dp_smooth, dpdxy, u_bulk, v_bulk in inipar
-! topography_grid_convention moved from userpar
-!
-! 197 2008-09-16 15:29:03Z raasch
-! +cthf,leaf_surface_concentration, scalar_exchange_coefficient
-! +inflow_damping_height, inflow_damping_width, recycling_width,
-! turbulent_inflow in inipar, -skip_time_dosp in d3par,
-! allocation of hom_sum moved from init_3d_model to here,
-! npex, npey moved from inipar to d3par, setting of myid_char_14 removed,
-! lad is allways allocated
-!
-! 138 2007-11-28 10:03:58Z letzel
-! +canopy_mode, drag_coefficient, lad_surface, lad_vertical_gradient, 
-! lad_vertical_gradient_level, pch_index, plant_canopy, 
-! +allocation of leaf area density field
-!
-! 108 2007-08-24 15:10:38Z letzel
-! +e_init, top_momentumflux_u|v in inipar, +dt_coupling in d3par
-!
-! 95 2007-06-02 16:48:38Z raasch
-! +bc_sa_t, bottom_salinityflux, ocean, sa_surface, sa_vertical_gradient,
-! sa_vertical_gradient_level, top_salinityflux in inipar,
-! sa_init is allocated
-!
-! 87 2007-05-22 15:46:47Z raasch
-! Size of hom increased by the maximum number of user-defined profiles,
-! var_hom renamed pr_palm
-!
-! 82 2007-04-16 15:40:52Z raasch
-! +return_addres, return_username in envpar
-!
-! 75 2007-03-22 09:54:05Z raasch
-! +dt_max, netcdf_64bit_3d, precipitation_amount_interval in d3par,
-! +loop_optimization, pt_reference in inipar, -data_output_ts,
-! moisture renamed humidity
-!
-! 20 2007-02-26 00:12:32Z raasch
-! +top_heatflux, use_top_fluxes in inipar
-!
-! 3 2007-02-13 11:30:58Z raasch
-! +netcdf_64bit_3d in d3par,
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.57  2007/02/11 13:11:22  raasch
-! Values of environment variables are now read from file ENVPAR instead of
-! reading them with a system call, + NAMELIST envpar
-!
 ! Revision 1.1  1997/07/24 11:22:50  raasch
 ! Initial revision
@@ -211,20 +122,111 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE averaging
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE dvrp_variables
-    USE grid_variables
-    USE indices
-    USE model_1d
+    USE arrays_3d,                                                             &
+        ONLY:  lad, pt_init, q_init, ref_state, sa_init, ug, u_init, v_init,   &
+               vg
+
+    USE cloud_parameters,                                                      &
+        ONLY:  c_sedimentation, curvature_solution_effects,                    &
+               limiter_sedimentation, nc_const, ventilation_effect
+
+    USE control_parameters,                                                    &
+        ONLY:  alpha_surface, averaging_interval, averaging_interval_pr,       &
+               bc_e_b, bc_lr, bc_ns, bc_p_b, bc_p_t, bc_pt_b, bc_pt_t,         &
+               bc_q_b, bc_q_t,bc_s_b, bc_s_t, bc_sa_t, bc_uv_b, bc_uv_t,       &
+               bottom_salinityflux, building_height, building_length_x,        &
+               building_length_y, building_wall_left, building_wall_south,     &
+               call_psolver_at_all_substeps, canopy_mode, canyon_height,       &
+               canyon_width_x, canyon_width_y, canyon_wall_left,               &
+               canyon_wall_south, cfl_factor,                                  &
+               cloud_droplets, cloud_physics, cloud_scheme,                    &
+               conserve_volume_flow, conserve_volume_flow_mode,                &
+               coupling_start_time, create_disturbances, cthf, cycle_mg,       &
+               data_output, data_output_format, data_output_masks,             &
+               data_output_pr, data_output_2d_on_each_pe,                      &
+               disturbance_amplitude, disturbance_energy_limit,                &
+               disturbance_level_b, disturbance_level_t, dissipation_1d,       &
+               do2d_at_begin, do3d_at_begin, do3d_compress, do3d_comp_prec,    &
+               dp_external, dp_level_b, dp_smooth, dpdxy, drag_coefficient,    &
+               drizzle, dt, dz, dt_averaging_input, dt_averaging_input_pr,     &
+               dt_coupling, dt_data_output, dt_data_output_av, dt_disturb,     &
+               dt_domask, dt_dopr, dt_dopr_listing, dt_dots, dt_do2d_xy,       &
+               dt_do2d_xz, dt_do2d_yz, dt_do3d, dt_max, dt_restart,            &
+               dt_run_control, dz_max, dz_stretch_factor, dz_stretch_level,    &
+               end_time, e_init, e_min, fft_method, force_print_header,        &
+               galilei_transformation, host, humidity, inflow_damping_height,  &
+               inflow_damping_width, inflow_disturbance_begin,                 &
+               inflow_disturbance_end,  initializing_actions, io_blocks,       &
+               io_group, km_constant, lad_surface, lad_vertical_gradient,      &
+               lad_vertical_gradient_level, large_scale_forcing,               &
+               large_scale_subsidence, leaf_surface_concentration,             &
+               loop_optimization, masking_method, mask_scale_x, mask_scale_y,  &
+               mask_scale_z, mask_x, mask_y, mask_z, mask_x_loop,              &
+               mask_y_loop, mask_z_loop, maximum_cpu_time_allowed,             &
+               maximum_parallel_io_streams, max_pr_user, message_string,       &
+               mg_cycles, mg_switch_to_pe0_level, mixing_length_1d,            &
+               momentum_advec, netcdf_data_format, netcdf_precision, neutral,  &
+               ngsrb, normalizing_region, nsor, nsor_ini, nudging, ocean,      &
+               omega, omega_sor, passive_scalar, pch_index, phi, nz_do3d,      &
+               plant_canopy, prandtl_layer, prandtl_number, precipitation,     &
+               precipitation_amount_interval, psolver, pt_damping_factor,      &
+               pt_damping_width, pt_reference, pt_surface,                     &
+               pt_surface_initial_change, pt_vertical_gradient,                &
+               pt_vertical_gradient_level, q_surface,                          &
+               q_surface_initial_change, q_vertical_gradient,                  &
+               q_vertical_gradient_level, radiation, random_generator,         &
+               random_heatflux, rayleigh_damping_factor,                       &
+               rayleigh_damping_height, recycling_width, reference_state,      &
+               residual_limit, restart_time, return_addres, return_username,   &
+               revision, rif_max, rif_min, roughness_length, runnr,            &
+               run_identifier, sa_surface, sa_vertical_gradient,               &
+               sa_vertical_gradient_level, scalar_advec,                       &
+               scalar_exchange_coefficient, scalar_rayleigh_damping,           &
+               section_xy, section_xz, section_yz, skip_time_data_output,      &
+               skip_time_data_output_av, skip_time_dopr, skip_time_do2d_xy,    &
+               skip_time_do2d_xz, skip_time_do2d_yz, skip_time_do3d,           &
+               skip_time_domask, subs_vertical_gradient,                       &
+               subs_vertical_gradient_level, surface_heatflux,                 &
+               surface_pressure, surface_scalarflux, surface_waterflux,        &
+               synchronous_exchange,s_surface, s_surface_initial_change,       &
+               s_vertical_gradient, s_vertical_gradient_level,                 &
+               termination_time_needed, timestep_scheme, topography,           &
+               topography_grid_convention, top_heatflux,  top_momentumflux_u,  &
+               top_momentumflux_v, top_salinityflux,                           &
+               transpose_compute_overlap, turbulence, turbulent_inflow,        &
+               ug_surface, ug_vertical_gradient, ug_vertical_gradient_level,   &
+               use_surface_fluxes, use_cmax, use_top_fluxes,                   &
+               use_ug_for_galilei_tr, use_upstream_for_tke, uv_heights,        &
+               u_bulk, u_profile, vg_surface, vg_vertical_gradient,            &
+               vg_vertical_gradient_level, v_bulk, v_profile,                  &
+               wall_adjustment, wall_heatflux, wall_humidityflux,              &
+               wall_scalarflux, write_binary, z0h_factor, z_max_do2d
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log_barrierwait
+
+    USE dvrp_variables,                                                        &
+        ONLY:  local_dvrserver_running
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nx, ny, nz
+
+    USE model_1d,                                                              &
+        ONLY:  damp_level_1d, dt_pr_1d, dt_run_control_1d, end_time_1d
+
     USE pegrid
-    USE profil_parameter
-    USE statistics
+
+    USE profil_parameter,                                                      &
+        ONLY:  cross_profiles, cross_ts_uymax, cross_ts_uymin,                 &
+               profile_columns, profile_rows
+
+    USE statistics,                                                            &
+        ONLY:  hom, hom_sum, pr_palm, region, statistic_regions
 
     IMPLICIT NONE
 
-    INTEGER ::  i
+    INTEGER(iwp) ::  i   !:
 
 
Index: /palm/trunk/SOURCE/plant_canopy_model.f90
===================================================================
--- /palm/trunk/SOURCE/plant_canopy_model.f90	(revision 1319)
+++ /palm/trunk/SOURCE/plant_canopy_model.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,13 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 257 2009-03-11 15:17:42Z heinze
-! Output of messages replaced by message handling routine.
-! Bugfix: remove IF statement in plant_canopy_model_ij
-!
-! 153 2008-03-19 09:41:30Z steinfeld
-! heat sources within the forest canopy are added, which represent the
-! rate of heat input into the air from the forest leaves, evaluation of sinks
-! and sources for scalar concentration due to canopy elements
 !
 ! 138 2007-11-28 10:03:58Z letzel
@@ -63,12 +60,23 @@
     SUBROUTINE plant_canopy_model( component )
 
-       USE arrays_3d
-       USE control_parameters
-       USE indices
-       USE pegrid
+       USE arrays_3d,                                                          &
+           ONLY:  canopy_heat_flux, cdc, dzw, e, lad_s, lad_u, lad_v, lad_w,   &
+                  q, sec, sls, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  pch_index, message_string
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxlu, nxr, nys, nysv, nyn, nzb_s_inner, nzb_u_inner,    &
+                  nzb_v_inner, nzb_w_inner
+
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  component, i, j, k
+       INTEGER(iwp) ::  component  !:
+       INTEGER(iwp) ::  i          !:
+       INTEGER(iwp) ::  j          !:
+       INTEGER(iwp) ::  k          !:
  
 !
@@ -154,5 +162,5 @@
                 DO  j = nys, nyn
                    DO  k = nzb_s_inner(j,i)+1, pch_index
-                      tend(k,j,i) = tend(k,j,i) +                     &
+                      tend(k,j,i) = tend(k,j,i) +                   &
                                     ( canopy_heat_flux(k,j,i) -     &
                                       canopy_heat_flux(k-1,j,i) ) / &
@@ -221,15 +229,26 @@
     SUBROUTINE plant_canopy_model_ij( i, j, component )
 
-       USE arrays_3d
-       USE control_parameters
-       USE indices
-       USE pegrid
+       USE arrays_3d,                                                          &
+           ONLY:  canopy_heat_flux, cdc, dzw, e, lad_s, lad_u, lad_v, lad_w,   &
+                  q, sec, sls, tend, u, v, w
+
+       USE control_parameters,                                                 &
+           ONLY:  pch_index, message_string
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxlu, nxr, nys, nysv, nyn, nzb_s_inner, nzb_u_inner,    &
+                  nzb_v_inner, nzb_w_inner
+
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  component, i, j, k
-
-!
-!--    Compute drag for the three velocity components 
+       INTEGER(iwp) ::  component  !:
+       INTEGER(iwp) ::  i          !:
+       INTEGER(iwp) ::  j          !:
+       INTEGER(iwp) ::  k          !:
+
+!
+!--    Compute drag for the three velocity components
        SELECT CASE ( component )
 
@@ -238,5 +257,5 @@
        CASE ( 1 )
           DO  k = nzb_u_inner(j,i)+1, pch_index
-             tend(k,j,i) = tend(k,j,i) -                  &
+             tend(k,j,i) = tend(k,j,i) -                     &
                               cdc(k,j,i) * lad_u(k,j,i) *    &   
                               SQRT(     u(k,j,i)**2 +        &
@@ -258,5 +277,5 @@
        CASE ( 2 )
           DO  k = nzb_v_inner(j,i)+1, pch_index
-             tend(k,j,i) = tend(k,j,i) -                  &
+             tend(k,j,i) = tend(k,j,i) -                     &
                               cdc(k,j,i) * lad_v(k,j,i) *    &
                               SQRT( ( ( u(k,j-1,i)   +       &
@@ -278,5 +297,5 @@
        CASE ( 3 )
           DO  k = nzb_w_inner(j,i)+1, pch_index
-             tend(k,j,i) = tend(k,j,i) -                  &
+             tend(k,j,i) = tend(k,j,i) -                     &
                               cdc(k,j,i) * lad_w(k,j,i) *    & 
                               SQRT( ( ( u(k,j,i)    +        &  
@@ -299,5 +318,5 @@
           CASE ( 4 )
              DO  k = nzb_s_inner(j,i)+1, pch_index
-                tend(k,j,i) = tend(k,j,i) +                     &
+                tend(k,j,i) = tend(k,j,i) +                   &
                               ( canopy_heat_flux(k,j,i) -     &
                                 canopy_heat_flux(k-1,j,i) ) / &
@@ -328,5 +347,5 @@
        CASE ( 6 )
           DO  k = nzb_s_inner(j,i)+1, pch_index   
-             tend(k,j,i) = tend(k,j,i) -                     &
+             tend(k,j,i) = tend(k,j,i) -                        &
                               2.0 * cdc(k,j,i) * lad_s(k,j,i) * &
                               SQRT( ( ( u(k,j,i)           +    &
Index: /palm/trunk/SOURCE/poisfft.f90
===================================================================
--- /palm/trunk/SOURCE/poisfft.f90	(revision 1319)
+++ /palm/trunk/SOURCE/poisfft.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -95,56 +101,4 @@
 ! (most of the code is unneeded by check_namelist_files).
 !
-! 763 2011-10-06 09:32:09Z suehring
-! Comment added concerning the last change.
-!
-! 761 2011-10-05 17:58:52Z suehring
-! Bugfix: Avoid divisions by zero in case of using a 'neumann' bc for the
-! pressure at the top of the model domain.
-!
-! 696 2011-03-18 07:03:49Z raasch
-! work_fftx removed from PRIVATE clauses in fftx_tr_xy and tr_yx_fftx
-!
-! 683 2011-02-09 14:25:15Z raasch
-! openMP parallelization for 2d-domain-decomposition
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! ddzu replaced by ddzu_pres due to changes in zu(0)
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 377 2009-09-04 11:09:00Z raasch
-! __lcmuk changed to __lc to avoid problems with Intel compiler on sgi-ice
-!
-! 164 2008-05-15 08:46:15Z raasch
-! Arguments removed from transpose routines
-!
-! 128 2007-10-26 13:11:14Z raasch
-! Bugfix: wavenumber calculation for even nx in routines maketri
-!
-! 85 2007-05-11 09:35:14Z raasch
-! Bugfix: work_fft*_vec removed from some PRIVATE-declarations
-!
-! 76 2007-03-29 00:58:32Z raasch
-! Tridiagonal coefficients adjusted for Neumann boundary conditions both at
-! the bottom and the top.
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.24  2006/08/04 15:00:24  raasch
-! Default setting of the thread number tn in case of not using OpenMP
-!
-! Revision 1.23  2006/02/23 12:48:38  raasch
-! Additional compiler directive in routine tridia_1dd for preventing loop
-! exchange on NEC-SX6
-!
-! Revision 1.20  2004/04/30 12:38:09  raasch
-! Parts of former poisfft_hybrid moved to this subroutine,
-! former subroutine changed to a module, renaming of FFT-subroutines and
-! -module, FFTs completely substituted by calls of fft_x and fft_y,
-! NAG fft used in the non-parallel case completely removed, l in maketri
-! is now a 1d-array, variables passed by modules instead of using parameter
-! lists, enlarged transposition arrays introduced
-!
 ! Revision 1.1  1997/07/24 11:24:14  raasch
 ! Initial revision
@@ -167,8 +121,16 @@
 !------------------------------------------------------------------------------!
 
-    USE fft_xy
-    USE indices
-    USE transpose_indices
-    USE tridia_solver
+    USE fft_xy,                                                                &
+        ONLY:  fft_init, fft_y, fft_y_1d, fft_y_m, fft_x, fft_x_1d, fft_x_m
+
+    USE indices,                                                               &
+        ONLY:  nnx, nny, nx, nxl, nxr, ny, nys, nyn, nz
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxl_z, nxr_y, nxr_z, nys_x, nys_z, nyn_x, nyn_z, nzb_x,  &
+               nzb_y, nzt_x, nzt_y
+
+    USE tridia_solver,                                                         &
+        ONLY:  tridia_1dd, tridia_init, tridia_substi, tridia_substi_overlap
 
     IMPLICIT NONE
@@ -200,9 +162,12 @@
     SUBROUTINE poisfft_init
 
-       USE arrays_3d,  ONLY:  ddzu_pres, ddzw
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu_pres, ddzw
+
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  k
+       INTEGER(iwp) ::  k  !:
 
 
@@ -219,20 +184,45 @@
     SUBROUTINE poisfft( ar )
 
-       USE control_parameters,  ONLY : fft_method, transpose_compute_overlap
-       USE cpulog
+       USE control_parameters,                                                 &
+           ONLY:  fft_method, transpose_compute_overlap
+
+       USE cpulog,                                                             &
+           ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+       USE kinds
+
        USE pegrid
 
        IMPLICIT NONE
 
-       INTEGER ::  ii, iind, inew, jj, jind, jnew, ki, kk, knew, n, nblk, &
-                   nnx_y, nny_z, nnz_t, nnz_x, nxl_y_bound, nxr_y_bound
-       INTEGER, DIMENSION(4) ::  isave
-
-       REAL, DIMENSION(1:nz,nys:nyn,nxl:nxr) ::  ar
+       INTEGER(iwp) ::  ii           !:
+       INTEGER(iwp) ::  iind         !:
+       INTEGER(iwp) ::  inew         !:
+       INTEGER(iwp) ::  jj           !:
+       INTEGER(iwp) ::  jind         !:
+       INTEGER(iwp) ::  jnew         !:
+       INTEGER(iwp) ::  ki           !:
+       INTEGER(iwp) ::  kk           !:
+       INTEGER(iwp) ::  knew         !:
+       INTEGER(iwp) ::  n            !:
+       INTEGER(iwp) ::  nblk         !:
+       INTEGER(iwp) ::  nnx_y        !:
+       INTEGER(iwp) ::  nny_z        !:
+       INTEGER(iwp) ::  nnz_t        !:
+       INTEGER(iwp) ::  nnz_x        !:
+       INTEGER(iwp) ::  nxl_y_bound  !:
+       INTEGER(iwp) ::  nxr_y_bound  !:
+
+       INTEGER(iwp), DIMENSION(4) ::  isave  !:
+
+       REAL(wp), DIMENSION(1:nz,nys:nyn,nxl:nxr) ::  ar      !:
        !$acc declare create( ar_inv )
-       REAL, DIMENSION(nys:nyn,nxl:nxr,1:nz) ::  ar_inv
-
-       REAL, DIMENSION(:,:,:),   ALLOCATABLE ::  ar1, f_in, f_inv, f_out_y, &
-                                                 f_out_z
+       REAL(wp), DIMENSION(nys:nyn,nxl:nxr,1:nz) ::  ar_inv  !:
+
+       REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE ::  ar1      !:
+       REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE ::  f_in     !:
+       REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE ::  f_inv    !:
+       REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE ::  f_out_y  !:
+       REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE ::  f_out_z  !:
 
 
@@ -723,22 +713,32 @@
 !------------------------------------------------------------------------------!
 
-       USE control_parameters
-       USE cpulog
-       USE indices
+       USE control_parameters,                                                 &
+           ONLY:  host
+
+       USE cpulog,                                                             &
+           ONLY:  cpu_log, log_point_s
+
+       USE kinds
+
        USE pegrid
-       USE transpose_indices
 
        IMPLICIT NONE
 
-       INTEGER            ::  i, iend, iouter, ir, j, k
-       INTEGER, PARAMETER ::  stridex = 4
-
-       REAL, DIMENSION(0:ny,stridex)                    ::  work_ffty
+       INTEGER(iwp)            ::  i            !:
+       INTEGER(iwp)            ::  iend         !:
+       INTEGER(iwp)            ::  iouter       !:
+       INTEGER(iwp)            ::  ir           !:
+       INTEGER(iwp)            ::  j            !:
+       INTEGER(iwp)            ::  k            !:
+
+       INTEGER(iwp), PARAMETER ::  stridex = 4  !:
+
+       REAL(wp), DIMENSION(0:ny,stridex)        ::  work_ffty      !:
 #if defined( __nec )
-       REAL, DIMENSION(0:ny+1,1:nz,nxl:nxr)             ::  work_ffty_vec
+       REAL(wp), DIMENSION(0:ny+1,1:nz,nxl:nxr) ::  work_ffty_vec  !:
 #endif
-       REAL, DIMENSION(1:nz,0:ny,nxl:nxr)            ::  f_in
-       REAL, DIMENSION(nnx,1:nz,nys_x:nyn_x,pdims(1)) ::  f_out
-       REAL, DIMENSION(nxl:nxr,1:nz,0:ny)            ::  work
+       REAL(wp), DIMENSION(1:nz,0:ny,nxl:nxr)             ::  f_in   !:
+       REAL(wp), DIMENSION(nnx,1:nz,nys_x:nyn_x,pdims(1)) ::  f_out  !:
+       REAL(wp), DIMENSION(nxl:nxr,1:nz,0:ny)             ::  work   !:
 
 !
@@ -840,22 +840,32 @@
 !------------------------------------------------------------------------------!
 
-       USE control_parameters
-       USE cpulog
-       USE indices
+       USE control_parameters,                                                 &
+           ONLY:  host
+
+       USE cpulog,                                                             &
+           ONLY:  cpu_log, log_point_s
+
+       USE kinds
+
        USE pegrid
-       USE transpose_indices
 
        IMPLICIT NONE
 
-       INTEGER            ::  i, iend, iouter, ir, j, k
-       INTEGER, PARAMETER ::  stridex = 4
-
-       REAL, DIMENSION(0:ny,stridex)                    ::  work_ffty
+       INTEGER(iwp)            ::  i            !:
+       INTEGER(iwp)            ::  iend         !:
+       INTEGER(iwp)            ::  iouter       !:
+       INTEGER(iwp)            ::  ir           !:
+       INTEGER(iwp)            ::  j            !:
+       INTEGER(iwp)            ::  k            !:
+
+       INTEGER(iwp), PARAMETER ::  stridex = 4  !:
+
+       REAL(wp), DIMENSION(0:ny,stridex)        ::  work_ffty      !:
 #if defined( __nec )
-       REAL, DIMENSION(0:ny+1,1:nz,nxl:nxr)             ::  work_ffty_vec
+       REAL(wp), DIMENSION(0:ny+1,1:nz,nxl:nxr) ::  work_ffty_vec  !:
 #endif
-       REAL, DIMENSION(nnx,1:nz,nys_x:nyn_x,pdims(1)) ::  f_in
-       REAL, DIMENSION(1:nz,0:ny,nxl:nxr)             ::  f_out
-       REAL, DIMENSION(nxl:nxr,1:nz,0:ny)             ::  work
+       REAL(wp), DIMENSION(nnx,1:nz,nys_x:nyn_x,pdims(1)) ::  f_in   !:
+       REAL(wp), DIMENSION(1:nz,0:ny,nxl:nxr)             ::  f_out  !:
+       REAL(wp), DIMENSION(nxl:nxr,1:nz,0:ny)             ::  work   !:
 
 !
@@ -960,19 +970,31 @@
 !------------------------------------------------------------------------------!
 
-       USE control_parameters
-       USE cpulog
-       USE grid_variables
-       USE indices
+       USE control_parameters,                                                 &
+           ONLY:  host
+
+       USE cpulog,                                                             &
+           ONLY:  cpu_log, log_point_s
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx2, ddy2
+
+       USE kinds
+
        USE pegrid
-       USE transpose_indices
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, m, n, omp_get_thread_num, tn
-
-       REAL, DIMENSION(0:nx)                          ::  work_fftx
-       REAL, DIMENSION(0:nx,1:nz)                     ::  work_trix
-       REAL, DIMENSION(nnx,1:nz,nys_x:nyn_x,pdims(1)) ::  ar
-       REAL, DIMENSION(:,:,:,:), ALLOCATABLE          ::  tri
+       INTEGER(iwp) ::  i                   !:
+       INTEGER(iwp) ::  j                   !:
+       INTEGER(iwp) ::  k                   !:
+       INTEGER(iwp) ::  m                   !:
+       INTEGER(iwp) ::  n                   !:
+       INTEGER(iwp) ::  omp_get_thread_num  !:
+       INTEGER(iwp) ::  tn                  !:
+
+       REAL(wp), DIMENSION(0:nx)                          ::  work_fftx  !:
+       REAL(wp), DIMENSION(0:nx,1:nz)                     ::  work_trix  !:
+       REAL(wp), DIMENSION(nnx,1:nz,nys_x:nyn_x,pdims(1)) ::  ar         !:
+       REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE          ::  tri        !:
 
 
@@ -1091,18 +1113,24 @@
 !------------------------------------------------------------------------------!
 
-       USE control_parameters
-       USE cpulog
-       USE indices
+       USE control_parameters,                                                 &
+           ONLY:  host
+
+       USE cpulog,                                                             &
+           ONLY:  cpu_log, log_point_s
+
+       USE kinds
+
        USE pegrid
-       USE transpose_indices
 
        IMPLICIT NONE
 
-       INTEGER            ::  i, j, k
-
-       REAL, DIMENSION(0:nx,1:nz,nys:nyn)             ::  work_fftx
-       REAL, DIMENSION(1:nz,nys:nyn,0:nx)             ::  f_in
-       REAL, DIMENSION(nny,1:nz,nxl_y:nxr_y,pdims(2)) ::  f_out
-       REAL, DIMENSION(nys:nyn,1:nz,0:nx)             ::  work
+       INTEGER(iwp) ::  i  !:
+       INTEGER(iwp) ::  j  !:
+       INTEGER(iwp) ::  k  !:
+
+       REAL(wp), DIMENSION(0:nx,1:nz,nys:nyn)             ::  work_fftx  !:
+       REAL(wp), DIMENSION(1:nz,nys:nyn,0:nx)             ::  f_in       !:
+       REAL(wp), DIMENSION(nny,1:nz,nxl_y:nxr_y,pdims(2)) ::  f_out      !:
+       REAL(wp), DIMENSION(nys:nyn,1:nz,0:nx)             ::  work       !:
 
 !
@@ -1196,18 +1224,24 @@
 !------------------------------------------------------------------------------!
 
-       USE control_parameters
-       USE cpulog
-       USE indices
+       USE control_parameters,                                                 &
+           ONLY:  host
+
+       USE cpulog,                                                             &
+           ONLY:  cpu_log, log_point_s
+
+       USE kinds
+
        USE pegrid
-       USE transpose_indices
 
        IMPLICIT NONE
 
-       INTEGER            ::  i, j, k
-
-       REAL, DIMENSION(0:nx,1:nz,nys:nyn)             ::  work_fftx
-       REAL, DIMENSION(nny,1:nz,nxl_y:nxr_y,pdims(2)) ::  f_in
-       REAL, DIMENSION(1:nz,nys:nyn,0:nx)             ::  f_out
-       REAL, DIMENSION(nys:nyn,1:nz,0:nx)             ::  work
+       INTEGER(iwp) ::  i  !:
+       INTEGER(iwp) ::  j  !:
+       INTEGER(iwp) ::  k  !:
+
+       REAL(wp), DIMENSION(0:nx,1:nz,nys:nyn)             ::  work_fftx  !:
+       REAL(wp), DIMENSION(nny,1:nz,nxl_y:nxr_y,pdims(2)) ::  f_in       !:
+       REAL(wp), DIMENSION(1:nz,nys:nyn,0:nx)             ::  f_out      !:
+       REAL(wp), DIMENSION(nys:nyn,1:nz,0:nx)             ::  work       !:
 
 !
@@ -1301,19 +1335,31 @@
 !------------------------------------------------------------------------------!
 
-       USE control_parameters
-       USE cpulog
-       USE grid_variables
-       USE indices
+       USE control_parameters,                                                 &
+           ONLY:  host
+
+       USE cpulog,                                                             &
+           ONLY:  cpu_log, log_point_s
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx2, ddy2
+
+       USE kinds
+
        USE pegrid
-       USE transpose_indices
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, m, n, omp_get_thread_num, tn
-
-       REAL, DIMENSION(0:ny)                          ::  work_ffty
-       REAL, DIMENSION(0:ny,1:nz)                     ::  work_triy
-       REAL, DIMENSION(nny,1:nz,nxl_y:nxr_y,pdims(2)) ::  ar
-       REAL, DIMENSION(:,:,:,:), ALLOCATABLE          ::  tri
+       INTEGER(iwp) ::  i                   !:
+       INTEGER(iwp) ::  j                   !:
+       INTEGER(iwp) ::  k                   !:
+       INTEGER(iwp) ::  m                   !:
+       INTEGER(iwp) ::  n                   !:
+       INTEGER(iwp) ::  omp_get_thread_num  !:
+       INTEGER(iwp) ::  tn                  !:
+
+       REAL(wp), DIMENSION(0:ny)                          ::  work_ffty  !:
+       REAL(wp), DIMENSION(0:ny,1:nz)                     ::  work_triy  !:
+       REAL(wp), DIMENSION(nny,1:nz,nxl_y:nxr_y,pdims(2)) ::  ar         !:
+       REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE          ::  tri        !:
 
 
Index: /palm/trunk/SOURCE/poismg.f90
===================================================================
--- /palm/trunk/SOURCE/poismg.f90	(revision 1319)
+++ /palm/trunk/SOURCE/poismg.f90	(revision 1320)
@@ -23,5 +23,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -108,18 +114,32 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog    
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  d, p_loc
+
+    USE control_parameters,                                                    &
+        ONLY:  gathered_size, grid_level, grid_level_count,                    &
+               maximum_grid_level, message_string, mgcycles, mg_cycles,        &
+               mg_switch_to_pe0_level, residual_limit, subdomain_size
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxlg, nxl_mg, nxr, nxrg, nxr_mg, nys, nysg, nys_mg, nyn,   &
+               nyng, nyn_mg, nzb, nzt, nzt_mg
+
+    USE kinds
+
     USE pegrid
 
     IMPLICIT NONE
 
-    REAL    ::  maxerror, maximum_mgcycles, residual_norm
-
-    REAL, DIMENSION(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ::  r 
-
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  p3
+    REAL(wp) ::  maxerror          !:
+    REAL(wp) ::  maximum_mgcycles  !:
+    REAL(wp) ::  residual_norm     !:
+
+    REAL(wp), DIMENSION(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ::  r  !:
+
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  p3  !:
 
 
@@ -220,17 +240,39 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
-    USE pegrid
+    USE arrays_3d,                                                             &
+        ONLY:  f1_mg, f2_mg, f3_mg
+
+    USE control_parameters,                                                    &
+        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,   &
+               inflow_n, inflow_r, inflow_s, outflow_l, outflow_n, outflow_r,  &
+               outflow_s
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx2_mg, ddy2_mg
+
+    USE indices,                                                               &
+        ONLY:  flags, wall_flags_1, wall_flags_2, wall_flags_3, wall_flags_4,  &
+               wall_flags_5, wall_flags_6, wall_flags_7, wall_flags_8,         &
+               wall_flags_9, wall_flags_10, nxl_mg, nxr_mg, nys_mg, nyn_mg,    &
+               nzb, nzt_mg
+
+    USE kinds
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l
-
-    REAL, DIMENSION(nzb:nzt_mg(grid_level)+1,                                  &
+    INTEGER(iwp) ::  i
+    INTEGER(iwp) ::  j
+    INTEGER(iwp) ::  k
+    INTEGER(iwp) ::  l
+
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
                     nys_mg(grid_level)-1:nyn_mg(grid_level)+1,                 &
-                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f_mg, p_mg, r
+                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f_mg  !:
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
+                    nys_mg(grid_level)-1:nyn_mg(grid_level)+1,                 &
+                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  p_mg  !:
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
+                    nys_mg(grid_level)-1:nyn_mg(grid_level)+1,                 &
+                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  r     !:
 
 !
@@ -336,24 +378,52 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE grid_variables
-    USE indices
-    USE pegrid
+    USE control_parameters,                                                    &
+        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,   &
+               inflow_n, inflow_r, inflow_s, outflow_l, outflow_n, outflow_r,  &
+               outflow_s
+
+    USE indices,                                                               &
+        ONLY:  flags, wall_flags_1, wall_flags_2, wall_flags_3, wall_flags_4,  &
+               wall_flags_5, wall_flags_6, wall_flags_7, wall_flags_8,         &
+               wall_flags_9, wall_flags_10, nxl_mg, nxr_mg, nys_mg, nyn_mg,    &
+               nzb, nzt_mg
+
+    USE kinds
 
     IMPLICIT NONE
 
-    INTEGER ::  i, ic, j, jc, k, kc, l
-
-    REAL ::  rkjim, rkjip, rkjmi, rkjmim, rkjmip, rkjpi, rkjpim, rkjpip,       &
-             rkmji, rkmjim, rkmjip, rkmjmi, rkmjmim, rkmjmip, rkmjpi, rkmjpim, &
-             rkmjpip
-
-    REAL, DIMENSION(nzb:nzt_mg(grid_level)+1,                            &
-                    nys_mg(grid_level)-1:nyn_mg(grid_level)+1,           &
-                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f_mg
-
-    REAL, DIMENSION(nzb:nzt_mg(grid_level+1)+1,                          &
-                    nys_mg(grid_level+1)-1:nyn_mg(grid_level+1)+1,       &
-                    nxl_mg(grid_level+1)-1:nxr_mg(grid_level+1)+1) ::  r
+    INTEGER(iwp) ::  i    !:
+    INTEGER(iwp) ::  ic   !:
+    INTEGER(iwp) ::  j    !:
+    INTEGER(iwp) ::  jc   !:
+    INTEGER(iwp) ::  k    !:
+    INTEGER(iwp) ::  kc   !:
+    INTEGER(iwp) ::  l    !:
+
+    REAL(wp) ::  rkjim    !:
+    REAL(wp) ::  rkjip    !:
+    REAL(wp) ::  rkjmi    !:
+    REAL(wp) ::  rkjmim   !:
+    REAL(wp) ::  rkjmip   !:
+    REAL(wp) ::  rkjpi    !:
+    REAL(wp) ::  rkjpim   !:
+    REAL(wp) ::  rkjpip   !:
+    REAL(wp) ::  rkmji    !:
+    REAL(wp) ::  rkmjim   !:
+    REAL(wp) ::  rkmjip   !:
+    REAL(wp) ::  rkmjmi   !:
+    REAL(wp) ::  rkmjmim  !:
+    REAL(wp) ::  rkmjmip  !:
+    REAL(wp) ::  rkmjpi   !:
+    REAL(wp) ::  rkmjpim  !:
+    REAL(wp) ::  rkmjpip  !:
+
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                            &
+                        nys_mg(grid_level)-1:nyn_mg(grid_level)+1,           &
+                        nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f_mg  !:
+
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level+1)+1,                          &
+                        nys_mg(grid_level+1)-1:nyn_mg(grid_level+1)+1,       &
+                        nxl_mg(grid_level+1)-1:nxr_mg(grid_level+1)+1) ::  r !:
 
 !
@@ -516,19 +586,28 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE pegrid
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,   &
+               inflow_n, inflow_r, inflow_s, outflow_l, outflow_n, outflow_r,  &
+               outflow_s
+
+    USE indices,                                                               &
+        ONLY:  nxl_mg, nxr_mg, nys_mg, nyn_mg, nzb, nzt_mg
+
+    USE kinds
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l
-
-    REAL, DIMENSION(nzb:nzt_mg(grid_level-1)+1,                           &
-                    nys_mg(grid_level-1)-1:nyn_mg(grid_level-1)+1,        &
-                    nxl_mg(grid_level-1)-1:nxr_mg(grid_level-1)+1 ) ::  p
-
-    REAL, DIMENSION(nzb:nzt_mg(grid_level)+1,                           &
-                    nys_mg(grid_level)-1:nyn_mg(grid_level)+1,          &
-                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  temp
+    INTEGER(iwp) ::  i  !:
+    INTEGER(iwp) ::  j  !:
+    INTEGER(iwp) ::  k  !:
+    INTEGER(iwp) ::  l  !:
+
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level-1)+1,                           &
+                        nys_mg(grid_level-1)-1:nyn_mg(grid_level-1)+1,        &
+                        nxl_mg(grid_level-1)-1:nxr_mg(grid_level-1)+1 ) ::  p  !:
+
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                           &
+                        nys_mg(grid_level)-1:nyn_mg(grid_level)+1,          &
+                        nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  temp  !:
 
 
@@ -613,22 +692,53 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
-    USE pegrid
+    USE arrays_3d,                                                             &
+        ONLY:  f1_mg, f2_mg, f3_mg
+
+    USE control_parameters,                                                    &
+        ONLY:  bc_lr_cyc, bc_ns_cyc, grid_level, ibc_p_b, ibc_p_t, inflow_l,   &
+               inflow_n, inflow_r, inflow_s, ngsrb, outflow_l, outflow_n,      &
+               outflow_r, outflow_s
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx2_mg, ddy2_mg
+
+    USE indices,                                                               &
+        ONLY:  flags, wall_flags_1, wall_flags_2, wall_flags_3, wall_flags_4,  &
+               wall_flags_5, wall_flags_6, wall_flags_7, wall_flags_8,         &
+               wall_flags_9, wall_flags_10, nxl_mg, nxr_mg, nys_mg, nyn_mg,    &
+               nzb, nzt_mg
+
+    USE kinds
 
     IMPLICIT NONE
 
-    INTEGER :: colour, i, ic, j, jc, jj, k, l, n
-
-    LOGICAL :: unroll
-
-    REAL ::  wall_left, wall_north, wall_right, wall_south, wall_total, wall_top
-
-    REAL, DIMENSION(nzb:nzt_mg(grid_level)+1,                                 &
-                    nys_mg(grid_level)-1:nyn_mg(grid_level)+1,                &
-                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f_mg, p_mg
+    INTEGER(iwp) :: color    !:
+    INTEGER(iwp) :: i        !:
+    INTEGER(iwp) :: ic       !:
+    INTEGER(iwp) :: j        !:
+    INTEGER(iwp) :: jc       !:
+    INTEGER(iwp) :: jj       !:
+    INTEGER(iwp) :: k        !:
+    INTEGER(iwp) :: l        !:
+    INTEGER(iwp) :: n        !:
+
+    LOGICAL :: unroll        !:
+
+    REAL(wp) ::  wall_left   !:
+    REAL(wp) ::  wall_north  !:
+    REAL(wp) ::  wall_right  !:
+    REAL(wp) ::  wall_south  !:
+    REAL(wp) ::  wall_total  !:
+    REAL(wp) ::  wall_top    !:
+
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
+                        nys_mg(grid_level)-1:nyn_mg(grid_level)+1,             &
+                        nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f_mg  !:
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
+                        nys_mg(grid_level)-1:nyn_mg(grid_level)+1,             &
+                        nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  p_mg  !:
 
     l = grid_level
@@ -664,5 +774,5 @@
     DO  n = 1, ngsrb
        
-       DO  colour = 1, 2
+       DO  color = 1, 2
 
           IF ( .NOT. unroll )  THEN
@@ -673,5 +783,5 @@
 !--          Without unrolling of loops, no cache optimization
              DO  i = nxl_mg(l), nxr_mg(l), 2
-                DO  j = nys_mg(l) + 2 - colour, nyn_mg(l), 2 
+                DO  j = nys_mg(l) + 2 - color, nyn_mg(l), 2 
                    DO  k = nzb+1, nzt_mg(l), 2
 !                      p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
@@ -703,5 +813,5 @@
    
              DO  i = nxl_mg(l)+1, nxr_mg(l), 2
-                DO  j = nys_mg(l) + (colour-1), nyn_mg(l), 2
+                DO  j = nys_mg(l) + (color-1), nyn_mg(l), 2
                    DO  k = nzb+1, nzt_mg(l), 2 
                       p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
@@ -726,5 +836,5 @@
   
              DO  i = nxl_mg(l), nxr_mg(l), 2
-                DO  j = nys_mg(l) + (colour-1), nyn_mg(l), 2
+                DO  j = nys_mg(l) + (color-1), nyn_mg(l), 2
                    DO  k = nzb+2, nzt_mg(l), 2
                       p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
@@ -749,5 +859,5 @@
 
              DO  i = nxl_mg(l)+1, nxr_mg(l), 2
-                DO  j = nys_mg(l) + 2 - colour, nyn_mg(l), 2
+                DO  j = nys_mg(l) + 2 - color, nyn_mg(l), 2
                    DO  k = nzb+2, nzt_mg(l), 2
                       p_mg(k,j,i) = 1.0 / f1_mg(k,l) * (                       &
@@ -780,5 +890,5 @@
                 DO  jc = nys_mg(l), nyn_mg(l), 4
                    i  = ic
-                   jj = jc+2-colour
+                   jj = jc+2-color
                    DO  k = nzb+1, nzt_mg(l), 2
                       j = jj
@@ -819,5 +929,5 @@
    
                    i  = ic+1
-                   jj = jc+colour-1
+                   jj = jc+color-1
                    DO  k = nzb+1, nzt_mg(l), 2 
                       j =jj
@@ -858,5 +968,5 @@
 
                    i  = ic
-                   jj = jc+colour-1
+                   jj = jc+color-1
                    DO  k = nzb+2, nzt_mg(l), 2
                       j =jj
@@ -897,5 +1007,5 @@
 
                    i  = ic+1
-                   jj = jc+2-colour
+                   jj = jc+2-color
                    DO  k = nzb+2, nzt_mg(l), 2
                       j =jj
@@ -1027,20 +1137,38 @@
  SUBROUTINE mg_gather( f2, f2_sub )
 
-    USE control_parameters
-    USE cpulog
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  grid_level
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  mg_loc_ind, nxl_mg, nxr_mg, nys_mg, nyn_mg, nzb, nzt_mg
+
+    USE kinds
+
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER ::  i, il, ir, j, jn, js, k, nwords
-
-    REAL, DIMENSION(nzb:nzt_mg(grid_level)+1,                            &
-                    nys_mg(grid_level)-1:nyn_mg(grid_level)+1,           &
-                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f2, f2_l
-
-    REAL, DIMENSION(nzb:mg_loc_ind(5,myid)+1,                            &
-                    mg_loc_ind(3,myid)-1:mg_loc_ind(4,myid)+1,           &
-                    mg_loc_ind(1,myid)-1:mg_loc_ind(2,myid)+1) ::  f2_sub
+    INTEGER(iwp) ::  i       !:
+    INTEGER(iwp) ::  il      !:
+    INTEGER(iwp) ::  ir      !:
+    INTEGER(iwp) ::  j       !:
+    INTEGER(iwp) ::  jn      !:
+    INTEGER(iwp) ::  js      !:
+    INTEGER(iwp) ::  k       !:
+    INTEGER(iwp) ::  nwords  !:
+
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
+                    nys_mg(grid_level)-1:nyn_mg(grid_level)+1,                 &
+                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f2    !:
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
+                    nys_mg(grid_level)-1:nyn_mg(grid_level)+1,                 &
+                    nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) ::  f2_l  !:
+
+    REAL(wp), DIMENSION(nzb:mg_loc_ind(5,myid)+1,                              &
+                        mg_loc_ind(3,myid)-1:mg_loc_ind(4,myid)+1,             &
+                        mg_loc_ind(1,myid)-1:mg_loc_ind(2,myid)+1) ::  f2_sub  !:
 
 
@@ -1091,20 +1219,28 @@
 !-- non-blocking communication
 
-    USE control_parameters
-    USE cpulog
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  grid_level
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  mg_loc_ind, nxl_mg, nxr_mg, nys_mg, nyn_mg, nzb, nzt_mg
+
+    USE kinds
+
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER ::  nwords
-
-    REAL, DIMENSION(nzb:nzt_mg(grid_level-1)+1,                            &
-                    nys_mg(grid_level-1)-1:nyn_mg(grid_level-1)+1,         &
-                    nxl_mg(grid_level-1)-1:nxr_mg(grid_level-1)+1) ::  p2
-
-    REAL, DIMENSION(nzb:mg_loc_ind(5,myid)+1,                              &
-                    mg_loc_ind(3,myid)-1:mg_loc_ind(4,myid)+1,             &
-                    mg_loc_ind(1,myid)-1:mg_loc_ind(2,myid)+1) ::  p2_sub
+    INTEGER(iwp) ::  nwords  !:
+
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level-1)+1,                            &
+                        nys_mg(grid_level-1)-1:nyn_mg(grid_level-1)+1,         &
+                        nxl_mg(grid_level-1)-1:nxr_mg(grid_level-1)+1) ::  p2  !:
+
+    REAL(wp), DIMENSION(nzb:mg_loc_ind(5,myid)+1,                              &
+                        mg_loc_ind(3,myid)-1:mg_loc_ind(4,myid)+1,             &
+                        mg_loc_ind(1,myid)-1:mg_loc_ind(2,myid)+1) ::  p2_sub  !:
 
 !
@@ -1138,24 +1274,53 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE control_parameters,                                                    &
+        ONLY:  bc_lr_dirrad, bc_lr_raddir, bc_ns_dirrad, bc_ns_raddir,         &
+               gamma_mg, grid_level, grid_level_count, ibc_p_b, ibc_p_t,       &
+               inflow_l, inflow_n, inflow_r, inflow_s, maximum_grid_level,     &
+               mg_switch_to_pe0_level, mg_switch_to_pe0, ngsrb, outflow_l,     &
+               outflow_n, outflow_r, outflow_s
+
+
+    USE indices,                                                               &
+        ONLY:  mg_loc_ind, nxl, nxl_mg, nxr, nxr_mg, nys, nys_mg, nyn,         &
+               nyn_mg, nzb, nzt, nzt_mg
+
+    USE kinds
+
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, nxl_mg_save, nxr_mg_save, nyn_mg_save, nys_mg_save, &
-                nzt_mg_save
-
-    REAL, DIMENSION(nzb:nzt_mg(grid_level)+1,                                  &
-                 nys_mg(grid_level)-1:nyn_mg(grid_level)+1,                    &
-                 nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) :: f_mg, p_mg, p3, r
-
-    REAL, DIMENSION(nzb:nzt_mg(grid_level-1)+1,                                &
-                    nys_mg(grid_level-1)-1:nyn_mg(grid_level-1)+1,             &
-                    nxl_mg(grid_level-1)-1:nxr_mg(grid_level-1)+1) ::  f2, p2
-
-    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  f2_sub, p2_sub
+    INTEGER(iwp) ::  i            !:
+    INTEGER(iwp) ::  j            !:
+    INTEGER(iwp) ::  k            !:
+    INTEGER(iwp) ::  nxl_mg_save  !:
+    INTEGER(iwp) ::  nxr_mg_save  !:
+    INTEGER(iwp) ::  nyn_mg_save  !:
+    INTEGER(iwp) ::  nys_mg_save  !:
+    INTEGER(iwp) ::  nzt_mg_save  !:
+
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
+                        nys_mg(grid_level)-1:nyn_mg(grid_level)+1,             &
+                        nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) :: f_mg  !:
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
+                        nys_mg(grid_level)-1:nyn_mg(grid_level)+1,             &
+                        nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) :: p_mg  !:
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
+                        nys_mg(grid_level)-1:nyn_mg(grid_level)+1,             &
+                        nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) :: p3    !:
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level)+1,                              &
+                        nys_mg(grid_level)-1:nyn_mg(grid_level)+1,             &
+                        nxl_mg(grid_level)-1:nxr_mg(grid_level)+1) :: r     !:
+
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level-1)+1,                            &
+                        nys_mg(grid_level-1)-1:nyn_mg(grid_level-1)+1,         &
+                        nxl_mg(grid_level-1)-1:nxr_mg(grid_level-1)+1) ::  f2  !:
+    REAL(wp), DIMENSION(nzb:nzt_mg(grid_level-1)+1,                            &
+                        nys_mg(grid_level-1)-1:nyn_mg(grid_level-1)+1,         &
+                        nxl_mg(grid_level-1)-1:nxr_mg(grid_level-1)+1) ::  p2  !:
+
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  f2_sub  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  p2_sub  !:
 
 !
Index: /palm/trunk/SOURCE/prandtl_fluxes.f90
===================================================================
--- /palm/trunk/SOURCE/prandtl_fluxes.f90	(revision 1319)
+++ /palm/trunk/SOURCE/prandtl_fluxes.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -40,38 +46,4 @@
 ! 978 2012-08-09 08:28:32Z fricke
 ! roughness length for scalar quantities z0h added
-!
-! 759 2011-09-15 13:58:31Z raasch
-! Bugfix for ts limitation
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Changed surface boundary conditions for u and v from mirror to Dirichlet.
-! Therefore u(uzb,:,:) and v(nzb,:,:) are now representative for height z0.
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 315 2009-05-13 10:57:59Z raasch
-! Saturation condition at (sea) surface is not used in precursor runs (only
-! in the following coupled runs)
-! Bugfix: qsws was calculated in case of constant heatflux = .FALSE.
-!
-! 187 2008-08-06 16:25:09Z letzel
-! Bugfix: modification of the calculation of the vertical turbulent momentum
-! fluxes u'w' and v'w'
-! Bugfix: change definition of us_wall from 1D to 2D
-! Change: modification of the integrated version of the profile function for 
-! momentum for unstable stratification (does not effect results)
-!
-! 108 2007-08-24 15:10:38Z letzel
-! assume saturation at k=nzb_s_inner(j,i) for atmosphere coupled to ocean
-!
-! 75 2007-03-22 09:54:05Z raasch
-! moisture renamed humidity
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.19  2006/04/26 12:24:35  raasch
-! +OpenMP directives and optimization (array assignments replaced by DO loops)
 !
 ! Revision 1.1  1998/01/23 10:06:06  raasch
@@ -85,14 +57,34 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  e, pt, q, qs, qsws, rif, shf, ts, u, us, usws, v, vpt, vsws,    &
+               zu, zw, z0, z0h
+
+    USE control_parameters,                                                    &
+        ONLY:  constant_heatflux, constant_waterflux, coupling_mode, g,        &
+               humidity, ibc_e_b, kappa, large_scale_forcing, lsf_surf,        &
+               passive_scalar, pt_surface, q_surface, rif_max, rif_min,        &
+               run_coupled, surface_pressure
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb_s_inner,        &
+               nzb_u_inner, nzb_v_inner
+
+    USE kinds
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k
-    LOGICAL ::  coupled_run
-    REAL    ::  a, b, e_q, rifm, uv_total, z_p
+    INTEGER(iwp) ::  i            !:
+    INTEGER(iwp) ::  j            !:
+    INTEGER(iwp) ::  k            !:
+
+    LOGICAL      ::  coupled_run  !:
+
+    REAL(wp)     ::  a            !:
+    REAL(wp)     ::  b            !:
+    REAL(wp)     ::  e_q          !:
+    REAL(wp)     ::  rifm         !:
+    REAL(wp)     ::  uv_total     !:
+    REAL(wp)     ::  z_p          !:
 
 !
Index: /palm/trunk/SOURCE/pres.f90
===================================================================
--- /palm/trunk/SOURCE/pres.f90	(revision 1319)
+++ /palm/trunk/SOURCE/pres.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -61,71 +67,4 @@
 ! 1003 2012-09-14 14:35:53Z raasch
 ! adjustment of array tend for cases with unequal subdomain sizes removed
-!
-! 778 2011-11-07 14:18:25Z fricke
-! New allocation of tend when multigrid is used and the collected field on PE0
-! has more grid points than the subdomain of an PE.
-!
-! 719 2011-04-06 13:05:23Z gryschka
-! Bugfix in volume flow control for double cyclic boundary conditions
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 707 2011-03-29 11:39:40Z raasch
-! Calculation of weighted average of p is now handled in the same way
-! regardless of the number of ghost layers (advection scheme),
-! multigrid and sor method are using p_loc for iterative advancements of
-! pressure, 
-! localsum calculation modified for proper OpenMP reduction,
-! bc_lr/ns replaced by bc_lr/ns_cyc
-!
-! 693 2011-03-08 09:..:..Z raasch
-! bugfix: weighting coefficient added to ibm branch
-!
-! 680 2011-02-04 23:16:06Z gryschka
-! bugfix: collective_wait
-!
-! 675 2011-01-19 10:56:55Z suehring
-! Removed bugfix while copying tend.
-!
-! 673 2011-01-18 16:19:48Z suehring
-! Weighting coefficients added for right computation of the pressure during
-! Runge-Kutta substeps. 
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! New allocation of tend when ws-scheme and multigrid is used. This is due to 
-! reasons of perforance of the data_exchange. The same is done with p after
-! poismg is called.
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng when no 
-! multigrid is used. Calls of exchange_horiz are modified.
-! bugfix: After pressure correction no volume flow correction in case of 
-! non-cyclic boundary conditions 
-! (has to be done only before pressure correction)
-! Call of SOR routine is referenced with ddzu_pres.
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 151 2008-03-07 13:42:18Z raasch
-! Bugfix in volume flow control for non-cyclic boundary conditions
-!
-! 106 2007-08-16 14:30:26Z raasch
-! Volume flow conservation added for the remaining three outflow boundaries
-!
-! 85 2007-05-11 09:35:14Z raasch
-! Division through dt_3d replaced by multiplication of the inverse.
-! For performance optimisation, this is done in the loop calculating the
-! divergence instead of using a seperate loop.
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Volume flow control for non-cyclic boundary conditions added (currently only
-! for the north boundary!!), 2nd+3rd argument removed from exchange horiz,
-! mean vertical velocity is removed in case of Neumann boundary conditions
-! both at the bottom and the top
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.25  2006/04/26 13:26:12  raasch
-! OpenMP optimization (+localsum, threadsum)
 !
 ! Revision 1.1  1997/07/24 11:24:44  raasch
@@ -140,22 +79,52 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE constants
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  d, ddzu, ddzu_pres, ddzw, dzw, p, p_loc, tend, u, v, w
+
+    USE control_parameters,                                                    &
+        ONLY:  bc_lr_cyc, bc_ns_cyc, conserve_volume_flow, dt_3d,              &
+               gathered_size, ibc_p_b, ibc_p_t, intermediate_timestep_count,   &
+               mg_switch_to_pe0_level, on_device, outflow_l, outflow_n,        &
+               outflow_r, outflow_s, psolver, simulated_time, subdomain_size,  &
+               topography, volume_flow, volume_flow_area, volume_flow_initial
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point, log_point_s
+
+    USE grid_variables,                                                        &
+        ONLY:  ddx, ddy
+
+    USE indices,                                                               &
+        ONLY:  nbgp, ngp_2dh_outer, nx, nxl, nxlg, nxl_mg, nxr, nxrg, nxr_mg,  &
+               ny, nys, nysg, nys_mg, nyn, nyng, nyn_mg, nzb, nzb_s_inner,     &
+               nzb_u_inner, nzb_v_inner, nzb_w_inner, nzb_2d, nzt, nzt_mg,     &
+               rflags_s_inner
+
+    USE kinds
+
     USE pegrid
-    USE poisfft_mod
-    USE statistics
+
+    USE poisfft_mod,                                                           &
+        ONLY:  poisfft
+
+    USE statistics,                                                            &
+        ONLY:  statistic_regions, sums_divnew_l, sums_divold_l, weight_pres,   &
+               weight_substep
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k
-
-    REAL    ::  ddt_3d, localsum, threadsum, d_weight_pres
-
-    REAL, DIMENSION(1:2) ::  volume_flow_l, volume_flow_offset
-    REAL, DIMENSION(1:nzt) ::  w_l, w_l_l
+    INTEGER(iwp) ::  i              !:
+    INTEGER(iwp) ::  j              !:
+    INTEGER(iwp) ::  k              !:
+
+    REAL(wp)     ::  ddt_3d         !:
+    REAL(wp)     ::  localsum       !:
+    REAL(wp)     ::  threadsum      !:
+    REAL(wp)     ::  d_weight_pres  !:
+
+    REAL(wp), DIMENSION(1:2)   ::  volume_flow_l       !:
+    REAL(wp), DIMENSION(1:2)   ::  volume_flow_offset  !:
+    REAL(wp), DIMENSION(1:nzt) ::  w_l                 !:
+    REAL(wp), DIMENSION(1:nzt) ::  w_l_l               !:
 
 
Index: /palm/trunk/SOURCE/print_1d.f90
===================================================================
--- /palm/trunk/SOURCE/print_1d.f90	(revision 1319)
+++ /palm/trunk/SOURCE/print_1d.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -35,7 +41,4 @@
 ! RCS Log replace by Id keyword, revision history cleaned up
 !
-! Revision 1.11  2006/02/23 12:50:43  raasch
-! Preliminary no output of time-averaged data
-!
 ! Revision 1.1  1997/09/19 07:45:22  raasch
 ! Initial revision
@@ -47,16 +50,30 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  zu, zw
+
+    USE control_parameters,                                                    &
+        ONLY:  run_description_header, simulated_time_chr
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE indices,                                                               &
+        ONLY:  nzb, nzt
+
+    USE kinds
+
     USE pegrid
-    USE statistics
+
+    USE statistics,                                                            &
+        ONLY:  flow_statistics_called, hom, region, statistic_regions
 
     IMPLICIT NONE
 
 
-    CHARACTER (LEN=20) ::  period_chr
-    INTEGER ::  k, sr
+    CHARACTER (LEN=20) ::  period_chr  !:
+
+    INTEGER(iwp) ::  k   !:
+    INTEGER(iwp) ::  sr  !:
 
 
Index: /palm/trunk/SOURCE/production_e.f90
===================================================================
--- /palm/trunk/SOURCE/production_e.f90	(revision 1319)
+++ /palm/trunk/SOURCE/production_e.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -50,55 +56,4 @@
 ! TKE production by buoyancy can be switched off in case of runs with pure
 ! neutral stratification
-!
-! 759 2011-09-15 13:58:31Z raasch
-! initialization of u_0, v_0
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 449 2010-02-02 11:23:59Z raasch
-! test output from rev 410 removed
-!
-! 388 2009-09-23 09:40:33Z raasch
-! Bugfix: wrong sign in buoyancy production of ocean part in case of not using
-!         the reference density (only in 3D routine production_e)
-! Bugfix to avoid zero division by km_neutral
-!
-! 208 2008-10-20 06:02:59Z raasch
-! Bugfix concerning the calculation of velocity gradients at vertical walls 
-! in case of diabatic conditions
-!
-! 187 2008-08-06 16:25:09Z letzel
-! Change: add 'minus' sign to fluxes obtained from subroutine wall_fluxes_e for
-! consistency with subroutine wall_fluxes
-!
-! 124 2007-10-19 15:47:46Z raasch
-! Bugfix: calculation of density flux in the ocean now starts from nzb+1
-!
-! 108 2007-08-24 15:10:38Z letzel
-! Bugfix: wrong sign removed from the buoyancy production term in the case
-! use_reference = .T.,
-! u_0 and v_0 are calculated for nxr+1, nyn+1 also (otherwise these values are
-! not available in case of non-cyclic boundary conditions)
-! Bugfix for ocean density flux at bottom
-!
-! 97 2007-06-21 08:23:15Z raasch
-! Energy production by density flux (in ocean) added
-! use_pt_reference renamed use_reference
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Wall functions now include diabatic conditions, call of routine wall_fluxes_e,
-! reference temperature pt_reference can be used in buoyancy term,
-! moisture renamed humidity
-!
-! 37 2007-03-01 08:33:54Z raasch
-! Calculation extended for gridpoint nzt, extended for given temperature /
-! humidity fluxes at the top, wall-part is now executed in case that a
-! Prandtl-layer is switched on (instead of surfaces fluxes switched on)
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.21  2006/04/26 12:45:35  raasch
-! OpenMP parallelization of production_e_init
 !
 ! Revision 1.1  1997/09/19 07:45:35  raasch
@@ -113,12 +68,16 @@
 !------------------------------------------------------------------------------!
 
-    USE wall_fluxes_mod
+    USE wall_fluxes_mod,                                                       &
+        ONLY:  wall_fluxes_e, wall_fluxes_e_acc
+
+    USE kinds
 
     PRIVATE
     PUBLIC production_e, production_e_acc, production_e_init
 
-    LOGICAL, SAVE ::  first_call = .TRUE.
-
-    REAL, DIMENSION(:,:), ALLOCATABLE, SAVE ::  u_0, v_0
+    LOGICAL, SAVE ::  first_call = .TRUE.  !:
+
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, SAVE ::  u_0  !:
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE, SAVE ::  v_0  !:
 
     INTERFACE production_e
@@ -143,20 +102,51 @@
     SUBROUTINE production_e
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, dd2zu, kh, km, pt, q, ql, qsws, qswst, rho, shf,       &
+                  tend, tswst, u, v, vpt, w
+
+       USE cloud_parameters,                                                   &
+           ONLY:  l_d_cp, l_d_r, pt_d_t, t_d_pt
+
+       USE control_parameters,                                                 &
+           ONLY:  cloud_droplets, cloud_physics, g, humidity, kappa, neutral,  &
+                  ocean, prandtl_layer, pt_reference, rho_reference,           &
+                  use_single_reference_value, use_surface_fluxes,              &
+                  use_top_fluxes
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, dx, ddy, dy, wall_e_x, wall_e_y
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nys, nyn, nzb, nzb_diff_s_inner,                   &
+                   nzb_diff_s_outer, nzb_s_inner, nzt, nzt_diff
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL    ::  def, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz, &
-                   k1, k2, km_neutral, theta, temp
-
-!       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  usvs, vsus, wsus, wsvs
-       REAL, DIMENSION(nzb:nzt+1) ::   usvs, vsus, wsus, wsvs
+       INTEGER(iwp) ::  i           !:
+       INTEGER(iwp) ::  j           !:
+       INTEGER(iwp) ::  k           !:
+
+       REAL(wp)     ::  def         !:
+       REAL(wp)     ::  dudx        !:
+       REAL(wp)     ::  dudy        !:
+       REAL(wp)     ::  dudz        !:
+       REAL(wp)     ::  dvdx        !:
+       REAL(wp)     ::  dvdy        !:
+       REAL(wp)     ::  dvdz        !:
+       REAL(wp)     ::  dwdx        !:
+       REAL(wp)     ::  dwdy        !:
+       REAL(wp)     ::  dwdz        !:
+       REAL(wp)     ::  k1          !:
+       REAL(wp)     ::  k2          !:
+       REAL(wp)     ::  km_neutral  !:
+       REAL(wp)     ::  theta       !:
+       REAL(wp)     ::  temp        !:
+
+!       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  usvs, vsus, wsus, wsvs
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  usvs  !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  vsus  !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  wsus  !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  wsvs  !:
 
 !
@@ -166,8 +156,8 @@
 !--    Therefore, ij-Version is called further below within the ij-loops.
 !       IF ( topography /= 'flat' )  THEN
-!          CALL wall_fluxes_e( usvs, 1.0, 0.0, 0.0, 0.0, wall_e_y )
-!          CALL wall_fluxes_e( wsvs, 0.0, 0.0, 1.0, 0.0, wall_e_y )
-!          CALL wall_fluxes_e( vsus, 0.0, 1.0, 0.0, 0.0, wall_e_x )
-!          CALL wall_fluxes_e( wsus, 0.0, 0.0, 0.0, 1.0, wall_e_x )
+!          CALL wall_fluxes_e( usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, wall_e_y )
+!          CALL wall_fluxes_e( wsvs, 0.0_wp, 0.0_wp, 1.0_wp, 0.0_wp, wall_e_y )
+!          CALL wall_fluxes_e( vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp, wall_e_x )
+!          CALL wall_fluxes_e( wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp, wall_e_x )
 !       ENDIF
 
@@ -240,7 +230,7 @@
 !--                         has been available
                       CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-                                          usvs, 1.0, 0.0, 0.0, 0.0 )
+                                          usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp )
                       CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-                                          wsvs, 0.0, 0.0, 1.0, 0.0 )
+                                          wsvs, 0.0_wp, 0.0_wp, 1.0_wp, 0.0_wp )
                       km_neutral = kappa * ( usvs(k)**2 + wsvs(k)**2 )**0.25 * &
                                    0.5 * dy 
@@ -270,7 +260,7 @@
 !--                         has been available
                       CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-                                          vsus, 0.0, 1.0, 0.0, 0.0 )
+                                          vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp )
                       CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-                                          wsus, 0.0, 0.0, 0.0, 1.0 )
+                                          wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp )
                       km_neutral = kappa * ( vsus(k)**2 + wsus(k)**2 )**0.25 * &
                                    0.5 * dx
@@ -716,19 +706,51 @@
     SUBROUTINE production_e_acc
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, dd2zu, kh, km, pt, q, ql, qsws, qswst, rho, shf,       &
+                  tend, tswst, u, v, vpt, w
+
+       USE cloud_parameters,                                                   &
+           ONLY:  l_d_cp, l_d_r, pt_d_t, t_d_pt
+
+       USE control_parameters,                                                 &
+           ONLY:  cloud_droplets, cloud_physics, g, humidity, kappa, neutral,  &
+                  ocean, prandtl_layer, pt_reference, rho_reference,           &
+                  topography, use_single_reference_value, use_surface_fluxes,  &
+                  use_top_fluxes
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, dx, ddy, dy, wall_e_x, wall_e_y
+
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nxl, nxr, nys, nyn, nzb,  &
+                  nzb_diff_s_inner, nzb_diff_s_outer, nzb_s_inner, nzt,        &
+                  nzt_diff
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL    ::  def, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz, &
-                   k1, k2, km_neutral, theta, temp
-
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  usvs, vsus, wsus, wsvs
+       INTEGER(iwp) ::  i           !:
+       INTEGER(iwp) ::  j           !:
+       INTEGER(iwp) ::  k           !:
+
+       REAL(wp)     ::  def         !:
+       REAL(wp)     ::  dudx        !:
+       REAL(wp)     ::  dudy        !:
+       REAL(wp)     ::  dudz        !:
+       REAL(wp)     ::  dvdx        !:
+       REAL(wp)     ::  dvdy        !:
+       REAL(wp)     ::  dvdz        !:
+       REAL(wp)     ::  dwdx        !:
+       REAL(wp)     ::  dwdy        !:
+       REAL(wp)     ::  dwdz        !:
+       REAL(wp)     ::  k1          !:
+       REAL(wp)     ::  k2          !:
+       REAL(wp)     ::  km_neutral  !:
+       REAL(wp)     ::  theta       !:
+       REAL(wp)     ::  temp        !:
+
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  usvs  !:
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  vsus  !:
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsus  !:
+       REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wsvs  !:
        !$acc declare create ( usvs, vsus, wsus, wsvs )
 
@@ -739,8 +761,8 @@
 !--    ij-version should be called further below within the ij-loops!!
        IF ( topography /= 'flat' )  THEN
-          CALL wall_fluxes_e_acc( usvs, 1.0, 0.0, 0.0, 0.0, wall_e_y )
-          CALL wall_fluxes_e_acc( wsvs, 0.0, 0.0, 1.0, 0.0, wall_e_y )
-          CALL wall_fluxes_e_acc( vsus, 0.0, 1.0, 0.0, 0.0, wall_e_x )
-          CALL wall_fluxes_e_acc( wsus, 0.0, 0.0, 0.0, 1.0, wall_e_x )
+          CALL wall_fluxes_e_acc( usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, wall_e_y )
+          CALL wall_fluxes_e_acc( wsvs, 0.0_wp, 0.0_wp, 1.0_wp, 0.0_wp, wall_e_y )
+          CALL wall_fluxes_e_acc( vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp, wall_e_x )
+          CALL wall_fluxes_e_acc( wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp, wall_e_x )
        ENDIF
 
@@ -823,7 +845,7 @@
 !--                               has been available
 !                            CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-!                                                usvs, 1.0, 0.0, 0.0, 0.0 )
+!                                                usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp )
 !                            CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-!                                                wsvs, 0.0, 0.0, 1.0, 0.0 )
+!                                                wsvs, 0.0_wp, 0.0_wp, 1.0_wp, 0.0_wp )
                             km_neutral = kappa *                                    &
                                         ( usvs(k,j,i)**2 + wsvs(k,j,i)**2 )**0.25 * &
@@ -854,7 +876,7 @@
 !--                               has been available
 !                            CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-!                                                vsus, 0.0, 1.0, 0.0, 0.0 )
+!                                                vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp )
 !                            CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-!                                                wsus, 0.0, 0.0, 0.0, 1.0 )
+!                                                wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp )
                             km_neutral = kappa *                                     &
                                          ( vsus(k,j,i)**2 + wsus(k,j,i)**2 )**0.25 * &
@@ -1350,19 +1372,50 @@
     SUBROUTINE production_e_ij( i, j )
 
-       USE arrays_3d
-       USE cloud_parameters
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  ddzw, dd2zu, kh, km, pt, q, ql, qsws, qswst, rho, shf,       &
+                  tend, tswst, u, v, vpt, w
+
+       USE cloud_parameters,                                                   &
+           ONLY:  l_d_cp, l_d_r, pt_d_t, t_d_pt
+
+       USE control_parameters,                                                 &
+           ONLY:  cloud_droplets, cloud_physics, g, humidity, kappa, neutral,  &
+                  ocean, prandtl_layer, pt_reference, rho_reference,           &
+                  use_single_reference_value, use_surface_fluxes,              &
+                  use_top_fluxes
+
+       USE grid_variables,                                                     &
+           ONLY:  ddx, dx, ddy, dy, wall_e_x, wall_e_y
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxr, nys, nyn, nzb, nzb_diff_s_inner,                   &
+                  nzb_diff_s_outer, nzb_s_inner, nzt, nzt_diff
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k
-
-       REAL    ::  def, dudx, dudy, dudz, dvdx, dvdy, dvdz, dwdx, dwdy, dwdz, &
-                   k1, k2, km_neutral, theta, temp
-
-       REAL, DIMENSION(nzb:nzt+1) ::  usvs, vsus, wsus, wsvs
+       INTEGER(iwp) ::  i           !:
+       INTEGER(iwp) ::  j           !:
+       INTEGER(iwp) ::  k           !:
+
+       REAL(wp)     ::  def         !:
+       REAL(wp)     ::  dudx        !:
+       REAL(wp)     ::  dudy        !:
+       REAL(wp)     ::  dudz        !:
+       REAL(wp)     ::  dvdx        !:
+       REAL(wp)     ::  dvdy        !:
+       REAL(wp)     ::  dvdz        !:
+       REAL(wp)     ::  dwdx        !:
+       REAL(wp)     ::  dwdy        !:
+       REAL(wp)     ::  dwdz        !:
+       REAL(wp)     ::  k1          !:
+       REAL(wp)     ::  k2          !:
+       REAL(wp)     ::  km_neutral  !:
+       REAL(wp)     ::  theta       !:
+       REAL(wp)     ::  temp        !:
+
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  usvs  !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  vsus  !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  wsus  !:
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  wsvs  !:
 
 !
@@ -1427,7 +1480,7 @@
 !--                   validation has been available
                 CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-                                    usvs, 1.0, 0.0, 0.0, 0.0 )
+                                    usvs, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp )
                 CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-                                    wsvs, 0.0, 0.0, 1.0, 0.0 )
+                                    wsvs, 0.0_wp, 0.0_wp, 1.0_wp, 0.0_wp )
                 km_neutral = kappa * ( usvs(k)**2 + wsvs(k)**2 )**0.25 * &
                              0.5 * dy
@@ -1457,7 +1510,7 @@
 !--                   validation has been available
                 CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-                                    vsus, 0.0, 1.0, 0.0, 0.0 )
+                                    vsus, 0.0_wp, 1.0_wp, 0.0_wp, 0.0_wp )
                 CALL wall_fluxes_e( i, j, k, nzb_diff_s_outer(j,i)-2, &
-                                    wsus, 0.0, 0.0, 0.0, 1.0 )
+                                    wsus, 0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp )
                 km_neutral = kappa * ( vsus(k)**2 + wsus(k)**2 )**0.25 * & 
                              0.5 * dx
@@ -1840,12 +1893,20 @@
     SUBROUTINE production_e_init
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
+       USE arrays_3d,                                                          &
+           ONLY:  kh, km, u, us, usws, v, vsws, zu
+
+       USE control_parameters,                                                 &
+           ONLY:  kappa, prandtl_layer
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb_u_inner,     &
+                  nzb_v_inner
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, ku, kv
+       INTEGER(iwp) ::  i   !:
+       INTEGER(iwp) ::  j   !:
+       INTEGER(iwp) ::  ku  !:
+       INTEGER(iwp) ::  kv  !:
 
        IF ( prandtl_layer )  THEN
Index: /palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- /palm/trunk/SOURCE/prognostic_equations.f90	(revision 1319)
+++ /palm/trunk/SOURCE/prognostic_equations.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -87,72 +93,4 @@
 ! temperature equation can be switched off
 !
-! 785 2011-11-28 09:47:19Z raasch
-! new factor rdf_sc allows separate Rayleigh damping of scalars
-!
-! 736 2011-08-17 14:13:26Z suehring
-! Bugfix: determination of first thread index i for WS-scheme
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 673 2011-01-18 16:19:48Z suehring
-! Consideration of the pressure gradient (steered by tsc(4)) during the time 
-! integration removed.
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Calls of the advection routines with WS5 added.
-! Calls of ws_statistics added to set the statistical arrays to zero after each 
-! time step.
-!
-! 531 2010-04-21 06:47:21Z heinze
-! add call of subsidence in the equation for humidity / passive scalar
-!
-! 411 2009-12-11 14:15:58Z heinze
-! add call of subsidence in the equation for potential temperature
-!
-! 388 2009-09-23 09:40:33Z raasch
-! prho is used instead of rho in diffusion_e,
-! external pressure gradient
-!
-! 153 2008-03-19 09:41:30Z steinfeld
-! add call of plant_canopy_model in the prognostic equation for
-! the potential temperature and for the passive scalar
-!
-! 138 2007-11-28 10:03:58Z letzel
-! add call of subroutines that evaluate the canopy drag terms,
-! add wall_*flux to parameter list of calls of diffusion_s
-!
-! 106 2007-08-16 14:30:26Z raasch
-! +uswst, vswst as arguments in calls of diffusion_u|v,
-! loops for u and v are starting from index nxlu, nysv, respectively (needed
-! for non-cyclic boundary conditions)
-!
-! 97 2007-06-21 08:23:15Z raasch
-! prognostic equation for salinity, density is calculated from equation of
-! state for seawater and is used for calculation of buoyancy,
-! +eqn_state_seawater_mod
-! diffusion_e is called with argument rho in case of ocean runs,
-! new argument zw in calls of diffusion_e, new argument pt_/prho_reference
-! in calls of buoyancy and diffusion_e, calc_mean_pt_profile renamed
-! calc_mean_profile
-!
-! 75 2007-03-22 09:54:05Z raasch
-! checking for negative q and limiting for positive values,
-! z0 removed from arguments in calls of diffusion_u/v/w, uxrp, vynp eliminated,
-! subroutine names changed to .._noopt, .._cache, and .._vector,
-! moisture renamed humidity, Bott-Chlond-scheme can be used in the
-! _vector-version
-!
-! 19 2007-02-23 04:53:48Z raasch
-! Calculation of e, q, and pt extended for gridpoint nzt,
-! handling of given temperature/humidity/scalar fluxes at top surface
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.21  2006/08/04 15:01:07  raasch
-! upstream scheme can be forced to be used for tke (use_upstream_for_tke)
-! regardless of the timestep scheme used for the other quantities,
-! new argument diss in call of diffusion_e
-!
 ! Revision 1.1  2000/04/13 14:56:27  schroeter
 ! Initial revision
@@ -164,38 +102,118 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE eqn_state_seawater_mod
-    USE grid_variables
-    USE indices
-    USE pegrid
-    USE pointer_interfaces
-    USE statistics
-    USE advec_ws
-    USE advec_s_pw_mod
-    USE advec_s_up_mod
-    USE advec_u_pw_mod
-    USE advec_u_up_mod
-    USE advec_v_pw_mod
-    USE advec_v_up_mod
-    USE advec_w_pw_mod
-    USE advec_w_up_mod
-    USE buoyancy_mod
-    USE calc_precipitation_mod
-    USE calc_radiation_mod
-    USE coriolis_mod
-    USE diffusion_e_mod
-    USE diffusion_s_mod
-    USE diffusion_u_mod
-    USE diffusion_v_mod
-    USE diffusion_w_mod
-    USE impact_of_latent_heat_mod
-    USE microphysics_mod
-    USE nudge_mod
-    USE plant_canopy_model_mod
-    USE production_e_mod
-    USE subsidence_mod
-    USE user_actions_mod
+    USE arrays_3d,                                                             &
+        ONLY:  diss_l_e, diss_l_nr, diss_l_pt, diss_l_q, diss_l_qr,            &
+               diss_l_sa, diss_s_e, diss_s_nr, diss_s_pt, diss_s_q,            &
+               diss_s_qr, diss_s_sa, e, e_p, flux_s_e, flux_s_nr, flux_s_pt,   &
+               flux_s_q, flux_s_qr, flux_s_sa, flux_l_e, flux_l_nr,            &
+               flux_l_pt, flux_l_q, flux_l_qr, flux_l_sa, nr, nr_p, nrsws,     &
+               nrswst, pt, ptdf_x, ptdf_y, pt_init, pt_p, prho, q, q_init,     &
+               q_p, qsws, qswst, qr, qr_p, qrsws, qrswst, rdf, rdf_sc, rho,    &
+               sa, sa_init, sa_p, saswsb, saswst, shf, tend, tend_nr,          &
+               tend_pt, tend_q, tend_qr, te_m, tnr_m, tpt_m, tq_m, tqr_m,      &
+               tsa_m, tswst, tu_m, tv_m, tw_m, u, ug, u_p, v, vg, vpt, v_p,    &
+               w, w_p
+        
+    USE control_parameters,                                                    &
+        ONLY:  cloud_physics, constant_diffusion, cthf, dp_external,           &
+               dp_level_ind_b, dp_smooth_factor, dpdxy, dt_3d, humidity,       &
+               icloud_scheme, inflow_l, intermediate_timestep_count,           &
+               intermediate_timestep_count_max, large_scale_subsidence,        &
+               neutral, nudging, ocean, outflow_l, outflow_s, passive_scalar,  &
+               plant_canopy, precipitation, prho_reference, prho_reference,    &
+               prho_reference, pt_reference, pt_reference, pt_reference,       &
+               radiation, scalar_advec, scalar_advec, simulated_time,          &
+               sloping_surface, timestep_scheme, tsc, use_upstream_for_tke,    &
+               use_upstream_for_tke, use_upstream_for_tke, wall_heatflux,      &
+               wall_nrflux, wall_qflux, wall_qflux, wall_qflux, wall_qrflux,   &
+               wall_salinityflux, ws_scheme_mom, ws_scheme_sca
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE eqn_state_seawater_mod,                                                &
+        ONLY:  eqn_state_seawater
+
+    USE indices,                                                               &
+        ONLY:  i_left, i_right, j_north, j_south, nxl, nxlu, nxr, nyn, nys,    &
+               nysv, nzb_s_inner, nzb_u_inner, nzb_v_inner, nzb_w_inner, nzt
+
+    USE advec_ws,                                                              &
+        ONLY:  advec_s_ws, advec_s_ws_acc, advec_u_ws, advec_u_ws_acc,         &
+               advec_v_ws, advec_v_ws_acc, advec_w_ws, advec_w_ws_acc
+
+    USE advec_s_pw_mod,                                                        &
+        ONLY:  advec_s_pw
+
+    USE advec_s_up_mod,                                                        &
+        ONLY:  advec_s_up
+
+    USE advec_u_pw_mod,                                                        &
+        ONLY:  advec_u_pw
+
+    USE advec_u_up_mod,                                                        &
+        ONLY:  advec_u_up
+
+    USE advec_v_pw_mod,                                                        &
+        ONLY:  advec_v_pw
+
+    USE advec_v_up_mod,                                                        &
+        ONLY:  advec_v_up
+
+    USE advec_w_pw_mod,                                                        &
+        ONLY:  advec_w_pw
+
+    USE advec_w_up_mod,                                                        &
+        ONLY:  advec_w_up
+
+    USE buoyancy_mod,                                                          &
+        ONLY:  buoyancy, buoyancy_acc
+
+    USE calc_precipitation_mod,                                                &
+        ONLY:  calc_precipitation
+
+    USE calc_radiation_mod,                                                    &
+        ONLY:  calc_radiation
+  
+    USE coriolis_mod,                                                          &
+        ONLY:  coriolis, coriolis_acc
+
+    USE diffusion_e_mod,                                                       &
+        ONLY:  diffusion_e, diffusion_e_acc
+
+    USE diffusion_s_mod,                                                       &
+        ONLY:  diffusion_s, diffusion_s_acc
+
+    USE diffusion_u_mod,                                                       &
+        ONLY:  diffusion_u, diffusion_u_acc
+
+    USE diffusion_v_mod,                                                       &
+        ONLY:  diffusion_v, diffusion_v_acc
+
+    USE diffusion_w_mod,                                                       &
+        ONLY:  diffusion_w, diffusion_w_acc
+
+    USE impact_of_latent_heat_mod,                                             &
+        ONLY:  impact_of_latent_heat
+
+    USE kinds
+
+    USE microphysics_mod,                                                      &
+        ONLY:  microphysics_control
+
+    USE nudge_mod,                                                             &
+        ONLY:  nudge
+
+    USE plant_canopy_model_mod,                                                &
+        ONLY:  plant_canopy_model
+
+    USE production_e_mod,                                                      &
+        ONLY:  production_e, production_e_acc
+
+    USE subsidence_mod,                                                        &
+        ONLY:  subsidence
+
+    USE user_actions_mod,                                                      &
+        ONLY:  user_actions
 
 
@@ -235,6 +253,12 @@
     IMPLICIT NONE
 
-    INTEGER ::  i, i_omp_start, j, k, omp_get_thread_num, tn = 0
-    LOGICAL ::  loop_start
+    INTEGER(iwp) ::  i                   !:
+    INTEGER(iwp) ::  i_omp_start         !:
+    INTEGER(iwp) ::  j                   !:
+    INTEGER(iwp) ::  k                   !:
+    INTEGER(iwp) ::  omp_get_thread_num  !:
+    INTEGER(iwp) ::  tn = 0              !:
+    
+    LOGICAL      ::  loop_start          !:
 
 
@@ -835,6 +859,9 @@
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k
-    REAL    ::  sbt
+    INTEGER(iwp) ::  i    !:
+    INTEGER(iwp) ::  j    !:
+    INTEGER(iwp) ::  k    !:
+
+    REAL(wp)     ::  sbt  !:
 
 
@@ -1479,6 +1506,10 @@
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, runge_step
-    REAL    ::  sbt
+    INTEGER(iwp) ::  i           !:
+    INTEGER(iwp) ::  j           !:
+    INTEGER(iwp) ::  k           !:
+    INTEGER(iwp) ::  runge_step  !:
+
+    REAL(wp)     ::  sbt         !:
 
 !
Index: /palm/trunk/SOURCE/random_function.f90
===================================================================
--- /palm/trunk/SOURCE/random_function.f90	(revision 1319)
+++ /palm/trunk/SOURCE/random_function.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -34,7 +40,4 @@
 ! RCS Log replace by Id keyword, revision history cleaned up
 !
-! Revision 1.3  2003/10/29 09:06:57  raasch
-! Former function changed to a module.
-!
 ! Revision 1.1  1998/02/04 16:09:45  raasch
 ! Initial revision
@@ -47,4 +50,6 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+
     IMPLICIT NONE
 
@@ -53,5 +58,6 @@
     PUBLIC random_function, random_function_ini
 
-    INTEGER, PUBLIC, SAVE ::  random_iv(32), random_iy
+    INTEGER(iwp), PUBLIC, SAVE ::  random_iv(32)  !:
+    INTEGER(iwp), PUBLIC, SAVE ::  random_iy      !:
 
     INTERFACE random_function_ini
@@ -79,12 +85,22 @@
        IMPLICIT NONE
 
-       INTEGER ::  ia, idum, im, iq, ir, ndiv, ntab
-       REAL    ::  am, eps, random_function, rnmx
+       INTEGER(iwp) ::  ia               !:
+       INTEGER(iwp) ::  idum             !:
+       INTEGER(iwp) ::  im               !:
+       INTEGER(iwp) ::  iq               !:
+       INTEGER(iwp) ::  ir               !:
+       INTEGER(iwp) ::  ndiv             !:
+       INTEGER(iwp) ::  ntab             !:
+
+       INTEGER(iwp) ::  j                !:
+       INTEGER(iwp) ::  k                !:
+
+       REAL(wp)     ::  am               !:
+       REAL(wp)     ::  eps              !:
+       REAL(wp)     ::  random_function  !:
+       REAL(wp)     ::  rnmx             !:
 
        PARAMETER ( ia=16807, im=2147483647, am=1.0/im, iq=127773, ir=2836, &
                    ntab=32, ndiv=1+(im-1)/ntab, eps=1.2e-7, rnmx=1.0-eps )
-
-       INTEGER ::  j, k
-
 
        IF ( idum .le. 0  .or.  random_iy .eq. 0 )  THEN
Index: /palm/trunk/SOURCE/random_gauss.f90
===================================================================
--- /palm/trunk/SOURCE/random_gauss.f90	(revision 1319)
+++ /palm/trunk/SOURCE/random_gauss.f90	(revision 1320)
@@ -20,6 +20,12 @@
 ! Current revisions:
 ! -----------------
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 ! 
-!
 ! Former revisions:
 ! -----------------
@@ -30,7 +36,4 @@
 !
 ! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.4  2006/08/04 15:01:48  raasch
-! Range of random number is limited by an upper limit (new second parameter)
 !
 ! Revision 1.1  1998/03/25 20:09:47  raasch
@@ -44,10 +47,21 @@
 !------------------------------------------------------------------------------!
 
-    USE random_function_mod
+    USE kinds
+
+    USE random_function_mod,                                                   &
+        ONLY:  random_function
 
     IMPLICIT NONE
 
-    INTEGER :: idum, iset
-    REAL    :: fac, gset, random_gauss, rsq, upper_limit, v1, v2
+    INTEGER(iwp) ::  idum          !:
+    INTEGER(iwp) ::  iset          !:
+
+    REAL(wp)     ::  fac           !:
+    REAL(wp)     ::  gset          !:
+    REAL(wp)     ::  random_gauss  !:
+    REAL(wp)     ::  rsq           !:
+    REAL(wp)     ::  upper_limit   !:
+    REAL(wp)     ::  v1            !:
+    REAL(wp)     ::  v2            !:
 
     SAVE  iset, gset
Index: /palm/trunk/SOURCE/read_3d_binary.f90
===================================================================
--- /palm/trunk/SOURCE/read_3d_binary.f90	(revision 1319)
+++ /palm/trunk/SOURCE/read_3d_binary.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -46,56 +52,4 @@
 ! +z0h, z0h_av
 !
-! 776 2011-10-31 08:02:51Z heinze
-! bugfix: increase binary_version due to last commit
-!
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt_av
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! +/- 1 replaced with +/- nbgp when swapping and allocating variables.
-! Bugfix: When using initializing_actions = 'cyclic_fill' in some cases
-! not the whole model domain was filled with data of the prerun.
-!
-! 410 2009-12-04 17:05:40Z letzel
-! format changed in test output from I2 to I4
-!
-! 367 2009-08-25 08:35:52Z maronga
-! Output of messages replaced by message handling routine.
-! +shf_av, qsws_av
-!
-! 220 2008-12-18 07:00:36Z raasch
-! reading mechanism completely revised (subdomain/total domain size can vary
-! arbitrarily between current and previous run)
-! Bugfix: reading of spectrum_x|y from restart files ignored if total numbers
-! of grid points do not match
-!
-! 150 2008-02-29 08:19:58Z raasch
-! Files from which restart data are to be read are determined and subsequently
-! opened. The total domain on the restart file is allowed to be smaller than
-! the current total domain. In this case it will be periodically mapped on the
-! current domain (needed for recycling method).
-! +call of user_read_restart_data, -dopr_time_count,
-! hom_sum, volume_flow_area, volume_flow_initial moved to read_var_list,
-! reading of old profil parameters (cross_..., dopr_crossindex, profile_***)
-! removed, initialization of spectrum_x|y removed
-!
-! 102 2007-07-27 09:09:17Z raasch
-! +uswst, uswst_m, vswst, vswst_m
-!
-! 96 2007-06-04 08:07:41Z raasch
-! +rho_av, sa, sa_av, saswsb, saswst
-!
-! 73 2007-03-20 08:33:14Z raasch
-! +precipitation_amount, precipitation_rate_av, rif_wall, u_m_l, u_m_r, etc.,
-! z0_av
-!
-! 19 2007-02-23 04:53:48Z raasch
-! +qswst, qswst_m, tswst, tswst_m
-! 
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.4  2006/08/04 15:02:32  raasch
-! +iran, iran_part
-!
 ! Revision 1.1  2004/04/30 12:47:27  raasch
 ! Initial revision
@@ -107,42 +61,106 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
+    USE arrays_3d,                                                             &
+        ONLY:  e, kh, km, p, pt, q, ql, qc, nr, nrs, nrsws, nrswst, qr, qrs,   &
+               qrsws, qrswst, qs, qsws, qswst, sa, saswsb, saswst, rif,        &
+               rif_wall, shf, ts, tswst, u, u_m_l, u_m_n, u_m_r, u_m_s, us,    &
+               usws, uswst, v, v_m_l, v_m_n, v_m_r, v_m_s, vpt, vsws, vswst,   &
+               w, w_m_l, w_m_n, w_m_r, w_m_s, z0, z0h
+
     USE averaging
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE indices
-    USE particle_attributes
+
+    USE cloud_parameters,                                                      &
+        ONLY:  prr, precipitation_amount
+
+    USE control_parameters,                                                    &
+        ONLY:  iran, humidity, passive_scalar, cloud_physics, cloud_droplets,  &
+               icloud_scheme, message_string, outflow_l, outflow_n, outflow_r, &
+               outflow_s, precipitation, ocean, topography
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, nx_on_file, ny, nys, nysg, nyn, &
+               nyng, ny_on_file, nzb, nzt
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  iran_part
+
     USE pegrid
-    USE profil_parameter
-    USE random_function_mod
-    USE statistics
+
+    USE random_function_mod,                                                   &
+        ONLY:  random_iv, random_iy
+
+    USE statistics,                                                            &
+        ONLY:  spectrum_x, spectrum_y
+
 
     IMPLICIT NONE
 
     CHARACTER (LEN=5)  ::  myid_char_save
-    CHARACTER (LEN=10) ::  binary_version, version_on_file
+    CHARACTER (LEN=10) ::  binary_version
+    CHARACTER (LEN=10) ::  version_on_file
     CHARACTER (LEN=20) ::  field_chr
 
-    INTEGER ::  files_to_be_opened, i, j, k, myid_on_file,                    &
-                numprocs_on_file, nxlc, nxlf, nxlpr, nxl_on_file, nxrc, nxrf, &
-                nxrpr, nxr_on_file, nync, nynf, nynpr, nyn_on_file, nysc,     &
-                nysf, nyspr, nys_on_file, nzb_on_file, nzt_on_file, offset_x, &
-                offset_y, shift_x, shift_y
-
-    INTEGER, DIMENSION(numprocs_previous_run) ::  file_list, overlap_count
-
-    INTEGER, DIMENSION(numprocs_previous_run,1000) ::  nxlfa, nxrfa, nynfa, &
-                                                       nysfa, offset_xa, &
-                                                       offset_ya
-    REAL ::  rdummy
-
-    REAL, DIMENSION(:,:), ALLOCATABLE     ::  tmp_2d
-    REAL, DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3d, tmp_3dwul, tmp_3dwun,    &
-                                              tmp_3dwur, tmp_3dwus, tmp_3dwvl, &
-                                              tmp_3dwvn, tmp_3dwvr, tmp_3dwvs, &
-                                              tmp_3dwwl, tmp_3dwwn, tmp_3dwwr, &
-                                              tmp_3dwws
-    REAL, DIMENSION(:,:,:,:), ALLOCATABLE ::  tmp_4d
+    INTEGER(iwp) ::  files_to_be_opened  !:
+    INTEGER(iwp) ::  i                   !:
+    INTEGER(iwp) ::  j                   !:
+    INTEGER(iwp) ::  k                   !:
+    INTEGER(iwp) ::  myid_on_file        !:
+    INTEGER(iwp) ::  numprocs_on_file    !:
+    INTEGER(iwp) ::  nxlc                !:
+    INTEGER(iwp) ::  nxlf                !:
+    INTEGER(iwp) ::  nxlpr               !:
+    INTEGER(iwp) ::  nxl_on_file         !:
+    INTEGER(iwp) ::  nxrc                !:
+    INTEGER(iwp) ::  nxrf                !:
+    INTEGER(iwp) ::  nxrpr               !:
+    INTEGER(iwp) ::  nxr_on_file         !:
+    INTEGER(iwp) ::  nync                !:
+    INTEGER(iwp) ::  nynf                !:
+    INTEGER(iwp) ::  nynpr               !:
+    INTEGER(iwp) ::  nyn_on_file         !:
+    INTEGER(iwp) ::  nysc                !:
+    INTEGER(iwp) ::  nysf                !:
+    INTEGER(iwp) ::  nyspr               !:
+    INTEGER(iwp) ::  nys_on_file         !:
+    INTEGER(iwp) ::  nzb_on_file         !:
+    INTEGER(iwp) ::  nzt_on_file         !:
+    INTEGER(iwp) ::  offset_x            !:
+    INTEGER(iwp) ::  offset_y            !:
+    INTEGER(iwp) ::  shift_x             !:
+    INTEGER(iwp) ::  shift_y             !:
+
+    INTEGER(iwp), DIMENSION(numprocs_previous_run) ::  file_list       !:
+    INTEGER(iwp), DIMENSION(numprocs_previous_run) ::  overlap_count   !:
+
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nxlfa      !:
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nxrfa      !:
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nynfa      !:
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nysfa      !:
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  offset_xa  !:
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  offset_ya  !:
+
+    REAL(wp) ::  rdummy
+
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE     ::  tmp_2d     !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3d     !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwul  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwun  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwur  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwus  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwvl  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwvn  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwvr  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwvs  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwwl  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwwn  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwwr  !:
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwws  !:
+
+    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  tmp_4d     !:
 
 
Index: /palm/trunk/SOURCE/read_var_list.f90
===================================================================
--- /palm/trunk/SOURCE/read_var_list.f90	(revision 1319)
+++ /palm/trunk/SOURCE/read_var_list.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -95,82 +101,4 @@
 ! +curvature_solution_effects
 !
-! 626 2010-12-10 13:04:12Z suehring 
-! idum replaced by cdum in read_parts_of_var_list
-!
-! 622 2010-12-10 08:08:13Z raasch
-! +collective_wait
-!
-! 600 2010-11-24 16:10:51Z raasch
-! +call_psolver_at_all_substeps, cfl_factor, cycle_mg, mg_cycles,
-! mg_switch_to_pe0_level, ngsrb, nsor, omega_sor, psolver,
-! rayleigh_damping_factor, rayleigh_damping_height, residual_limit
-! in routine skip_var_list (end of this file), variable ldum is replaced
-! by cdum(LEN=1), because otherwise read errors (too few data on file)
-! appear due to one of the additional parameters (cycle_mg) which are now
-! stored on the restart file
-!
-! 591 2010-10-28 06:35:52Z helmke
-! remove print command
-!
-! 587 2010-10-27 08:36:51Z helmke
-! +time_domask
-!
-! 580 2010-10-05 13:59:11Z heinze
-! Renaming of ws_vertical_gradient to subs_vertical_gradient,
-! ws_vertical_gradient_level to subs_vertical_gradient_level and
-! ws_vertical_gradient_level_ind to subs_vertical_gradient_level_i
-!
-! 411 2009-12-11 14:15:58Z heinze
-! +large_scale_subsidence, ws_vertical_gradient, ws_vertical_gradient_level,
-! ws_vertical_gradient_level_ind
-!
-! 345 2009-07-01 14:37:56Z heinze
-! +output_for_t0 
-! dt_fixed is read into a dummy variable.
-! Output of messages replaced by message handling routine.
-! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
-! canyon_wall_south, conserve_volume_flow_mode, coupling_start_time,
-! dp_external, dp_level_b, dp_smooth, dpdxy, run_coupled,
-! time_since_reference_point, topography_grid_convention, u_bulk, v_bulk
-!
-! 216 2008-11-25 07:12:43Z raasch
-! limitations for nx_on_file, ny_on_file removed (read_parts_of_var_list)
-!
-! 173 2008-05-23 20:39:38Z raasch
-! +cthf, leaf_surface_concentration, scalar_exchange_coefficient
-! +numprocs_previous_run, hor_index_bounds_previous_run, inflow_damping_factor,
-! inflow_damping_height, inflow_damping_width, mean_inflow_profiles,
-! recycling_width, turbulent_inflow,
-! -cross_ts_*, npex, npey,
-! hom_sum, volume_flow_area, volume_flow_initial moved from
-! read_3d_binary to here,
-! routines read_parts_of_var_list and skip_var_list added at the end
-!
-! 138 2007-11-28 10:03:58Z letzel
-! +canopy_mode, drag_coefficient, lad, lad_surface, lad_vertical_gradient, 
-! lad_vertical_gradient_level, lad_vertical_gradient_level_ind, pch_index,
-! plant_canopy, time_sort_particles
-!
-! 102 2007-07-27 09:09:17Z raasch
-! +time_coupling, top_momentumflux_u|v
-!
-! 95 2007-06-02 16:48:38Z raasch
-! +bc_sa_t, ocean, sa_init, sa_surface, sa_vertical_gradient,
-! sa_vertical_gradient_level, bottom/top_salinity_flux
-!
-! 87 2007-05-22 15:46:47Z raasch
-! +max_pr_user (version 3.1), var_hom renamed pr_palm
-!
-! 75 2007-03-22 09:54:05Z raasch
-! +loop_optimization, pt_reference, moisture renamed humidity
-!
-! 20 2007-02-26 00:12:32Z raasch
-! +top_heatflux, use_top_fluxes
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.34  2006/08/22 14:14:27  raasch
-! +dz_max
-!
 ! Revision 1.1  1998/03/18 20:18:48  raasch
 ! Initial revision
@@ -182,16 +110,33 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE averaging
-    USE cloud_parameters
+    USE arrays_3d,                                                             &
+        ONLY:  inflow_damping_factor, lad, mean_inflow_profiles, pt_init,      &
+               q_init, ref_state, sa_init, u_init, ug, v_init, vg
+
+    USE cloud_parameters,                                                      &
+        ONLY:  c_sedimentation, curvature_solution_effects,                    &
+               limiter_sedimentation, nc_const, ventilation_effect
+
     USE control_parameters
-    USE grid_variables
-    USE indices
-    USE model_1d
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+
+    USE indices,                                                               &
+        ONLY:  nz, nx, nx_on_file, ny, ny_on_file
+
+    USE model_1d,                                                              &
+        ONLY:  damp_level_1d, dt_pr_1d, dt_run_control_1d, end_time_1d
+
     USE netcdf_control
-    USE particle_attributes
+
+    USE particle_attributes,                                                   &
+        ONLY:  time_sort_particles
+
     USE pegrid
-    USE profil_parameter
-    USE statistics
+
+    USE statistics,                                                            &
+        ONLY:  statistic_regions, hom, hom_sum, pr_palm, u_max, u_max_ijk,     &
+               v_max, v_max_ijk, w_max, w_max_ijk
 
     IMPLICIT NONE
@@ -779,9 +724,20 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
+    USE arrays_3d,                                                             &
+        ONLY:  inflow_damping_factor, lad, mean_inflow_profiles, pt_init,      &
+               q_init, ref_state, sa_init, u_init, ug, v_init, vg
+
     USE control_parameters
-    USE indices
+
+    USE indices,                                                               &
+        ONLY:  nz, nx, nx_on_file, ny, ny_on_file
+
+    USE kinds
+
     USE pegrid
-    USE statistics
+
+    USE statistics,                                                            &
+        ONLY:  statistic_regions, hom, hom_sum, pr_palm, u_max, u_max_ijk,     &
+               v_max, v_max_ijk, w_max, w_max_ijk
 
     IMPLICIT NONE
@@ -791,9 +747,12 @@
     CHARACTER (LEN=1)  ::  cdum
 
-    INTEGER ::  max_pr_user_on_file, nz_on_file, &
-                statistic_regions_on_file, tmp_mpru, tmp_sr
-
-    REAL, DIMENSION(:,:,:),   ALLOCATABLE ::  hom_sum_on_file
-    REAL, DIMENSION(:,:,:,:), ALLOCATABLE ::  hom_on_file
+    INTEGER(iwp) ::  max_pr_user_on_file
+    INTEGER(iwp) ::  nz_on_file
+    INTEGER(iwp) ::  statistic_regions_on_file
+    INTEGER(iwp) ::  tmp_mpru
+    INTEGER(iwp) ::  tmp_sr
+
+    REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE ::  hom_sum_on_file
+    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  hom_on_file
 
 
Index: /palm/trunk/SOURCE/run_control.f90
===================================================================
--- /palm/trunk/SOURCE/run_control.f90	(revision 1319)
+++ /palm/trunk/SOURCE/run_control.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -38,19 +44,4 @@
 ! all actions concerning leapfrog scheme removed
 !
-! 97 2007-06-21 08:23:15Z raasch
-! Timestep and z_i format changed
-!
-! 87 2007-05-22 15:46:47Z raasch
-! var_hom renamed pr_palm
-!
-! 82 2007-04-16 15:40:52Z raasch
-! Preprocessor strings for different linux clusters changed to "lc",
-! routine local_flush is used for buffer flushing
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.20  2006/06/02 15:23:47  raasch
-! cpp-directives extended for lctit
-!
 ! Revision 1.1  1997/08/11 06:25:38  raasch
 ! Initial revision
@@ -62,9 +53,21 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE control_parameters,                                                    &
+        ONLY:  advected_distance_x, advected_distance_y,                       &
+               current_timestep_number, disturbance_created, dt_3d, mgcycles,  &
+               run_control_header, runnr, simulated_time, simulated_time_chr,  &
+               timestep_reason
+
+    USE indices,                                                               &
+        ONLY:  nzb
+
     USE pegrid
-    USE statistics
-    USE control_parameters
+
+    USE statistics,                                                            &
+        ONLY:  flow_statistics_called, hom, pr_palm, u_max, u_max_ijk, v_max,  &
+               v_max_ijk, w_max, w_max_ijk
 
     IMPLICIT NONE
Index: /palm/trunk/SOURCE/set_slicer_attributes_dvrp.f90
===================================================================
--- /palm/trunk/SOURCE/set_slicer_attributes_dvrp.f90	(revision 1319)
+++ /palm/trunk/SOURCE/set_slicer_attributes_dvrp.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -39,11 +45,18 @@
 #if defined( __dvrp_graphics )
 
-    USE control_parameters
-    USE dvrp_variables
+    USE dvrp_variables,                                                        &
+        ONLY:  dvrp_colortable_entries, interval_h_dvrp, interval_values_dvrp, &
+               slicer_range_limits_dvrp
+
+    USE kinds
 
     IMPLICIT NONE
 
-    INTEGER ::  j, n_slicer
-    REAL    ::  maxv, meav, minv
+    INTEGER(iwp) ::  j         !:
+    INTEGER(iwp) ::  n_slicer  !:
+
+    REAL(wp)     ::  maxv      !:
+    REAL(wp)     ::  meav      !:
+    REAL(wp)     ::  minv      !:
 
 
Index: /palm/trunk/SOURCE/singleton.f90
===================================================================
--- /palm/trunk/SOURCE/singleton.f90	(revision 1319)
+++ /palm/trunk/SOURCE/singleton.f90	(revision 1320)
@@ -4,16 +4,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
 !
 ! Former revisions:
 ! -----------------
-! $Id$
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.2  2004/04/30 12:52:09  raasch
-! Shape of arrays is explicitly stored in ishape and handled to the
-! fft-routines instead of the shape-function (due to a compiler error on
-! decalpha)
-!
 ! Revision 1.1  2002/05/02 18:56:59  raasch
 ! Initial revision
@@ -158,15 +152,15 @@
 !-----------------------------------------------------------------------------
 
+    USE kinds
+
     IMPLICIT NONE
 
     PRIVATE
-    PUBLIC:: fft, fftn, fftkind
-
-    INTEGER, PARAMETER:: fftkind = KIND(0.0) ! adjust here for other precisions
-
-    REAL(fftkind), PARAMETER:: sin60 = 0.86602540378443865_fftkind
-    REAL(fftkind), PARAMETER:: cos72 = 0.30901699437494742_fftkind
-    REAL(fftkind), PARAMETER:: sin72 = 0.95105651629515357_fftkind
-    REAL(fftkind), PARAMETER:: pi    = 3.14159265358979323_fftkind
+    PUBLIC:: fft, fftn
+
+    REAL(wp), PARAMETER:: sin60 = 0.86602540378443865_wp
+    REAL(wp), PARAMETER:: cos72 = 0.30901699437494742_wp
+    REAL(wp), PARAMETER:: sin72 = 0.95105651629515357_wp
+    REAL(wp), PARAMETER:: pi    = 3.14159265358979323_wp
 
     INTERFACE fft
@@ -187,13 +181,13 @@
 !
 !-- Formal parameters
-    COMPLEX(fftkind), DIMENSION(:), INTENT(IN)           :: array
-    INTEGER,          DIMENSION(:), INTENT(IN),  OPTIONAL:: dim
-    LOGICAL,                        INTENT(IN),  OPTIONAL:: inv
-    INTEGER,                        INTENT(OUT), OPTIONAL:: stat
+    COMPLEX(wp),  DIMENSION(:), INTENT(IN)           :: array
+    INTEGER(iwp), DIMENSION(:), INTENT(IN),  OPTIONAL:: dim
+    INTEGER(iwp),               INTENT(OUT), OPTIONAL:: stat
+    LOGICAL,                    INTENT(IN),  OPTIONAL:: inv
 !
 !-- Function result
-    COMPLEX(fftkind), DIMENSION(SIZE(array, 1)):: ft
-
-    INTEGER ::  ishape(1)
+    COMPLEX(wp), DIMENSION(SIZE(array, 1)):: ft
+
+    INTEGER(iwp)::  ishape(1)
 
 !
@@ -211,13 +205,13 @@
 !
 !-- Formal parameters
-    COMPLEX(fftkind), DIMENSION(:,:), INTENT(IN)           :: array
-    INTEGER,          DIMENSION(:),   INTENT(IN),  OPTIONAL:: dim
-    LOGICAL,                          INTENT(IN),  OPTIONAL:: inv
-    INTEGER,                          INTENT(OUT), OPTIONAL:: stat
+    COMPLEX(wp),  DIMENSION(:,:), INTENT(IN)           :: array
+    INTEGER(iwp), DIMENSION(:),   INTENT(IN),  OPTIONAL:: dim
+    INTEGER(iwp),                 INTENT(OUT), OPTIONAL:: stat
+    LOGICAL,                      INTENT(IN),  OPTIONAL:: inv
 !
 !-- Function result
-    COMPLEX(fftkind), DIMENSION(SIZE(array, 1), SIZE(array, 2)):: ft
-
-    INTEGER ::  ishape(2)
+    COMPLEX(wp), DIMENSION(SIZE(array, 1), SIZE(array, 2)):: ft
+
+    INTEGER(iwp) ::  ishape(2)
 !
 !-- Intrinsics used
@@ -234,14 +228,14 @@
 !
 !-- Formal parameters
-    COMPLEX(fftkind), DIMENSION(:,:,:), INTENT(IN)           :: array
-    INTEGER,          DIMENSION(:),     INTENT(IN),  OPTIONAL:: dim
-    LOGICAL,                            INTENT(IN),  OPTIONAL:: inv
-    INTEGER,                            INTENT(OUT), OPTIONAL:: stat
+    COMPLEX(wp),  DIMENSION(:,:,:), INTENT(IN)           :: array
+    INTEGER(iwp), DIMENSION(:),     INTENT(IN),  OPTIONAL:: dim
+    INTEGER(iwp),                   INTENT(OUT), OPTIONAL:: stat
+    LOGICAL,                        INTENT(IN),  OPTIONAL:: inv
 !
 !-- Function result
-    COMPLEX(fftkind), &
+    COMPLEX(wp), &
          DIMENSION(SIZE(array, 1), SIZE(array, 2), SIZE(array, 3)):: ft
 
-    INTEGER ::  ishape(3)
+    INTEGER(iwp) ::  ishape(3)
 
 !
@@ -259,14 +253,14 @@
 !
 !-- Formal parameters
-    COMPLEX(fftkind), DIMENSION(:,:,:,:), INTENT(IN)           :: array
-    INTEGER,          DIMENSION(:),       INTENT(IN),  OPTIONAL:: dim
-    LOGICAL,                              INTENT(IN),  OPTIONAL:: inv
-    INTEGER,                              INTENT(OUT), OPTIONAL:: stat
+    COMPLEX(wp),  DIMENSION(:,:,:,:), INTENT(IN)           :: array
+    INTEGER(iwp), DIMENSION(:),       INTENT(IN),  OPTIONAL:: dim
+    INTEGER(iwp),                     INTENT(OUT), OPTIONAL:: stat
+    LOGICAL,                          INTENT(IN),  OPTIONAL:: inv
 !
 !-- Function result
-    COMPLEX(fftkind), DIMENSION( &
+    COMPLEX(wp), DIMENSION( &
          SIZE(array, 1), SIZE(array, 2), SIZE(array, 3), SIZE(array, 4)):: ft
 
-    INTEGER ::  ishape(4)
+    INTEGER(iwp) ::  ishape(4)
 !
 !-- Intrinsics used
@@ -283,15 +277,15 @@
 !
 !-- Formal parameters
-    COMPLEX(fftkind), DIMENSION(:,:,:,:,:), INTENT(IN)           :: array
-    INTEGER,          DIMENSION(:),         INTENT(IN),  OPTIONAL:: dim
-    LOGICAL,                                INTENT(IN),  OPTIONAL:: inv
-    INTEGER,                                INTENT(OUT), OPTIONAL:: stat
+    COMPLEX(wp),  DIMENSION(:,:,:,:,:), INTENT(IN)           :: array
+    INTEGER(iwp), DIMENSION(:),         INTENT(IN),  OPTIONAL:: dim
+    INTEGER(iwp),                       INTENT(OUT), OPTIONAL:: stat
+    LOGICAL,                            INTENT(IN),  OPTIONAL:: inv
 !
 !-- Function result
-    COMPLEX(fftkind), DIMENSION( &
+    COMPLEX(wp), DIMENSION( &
          SIZE(array, 1), SIZE(array, 2), SIZE(array, 3), SIZE(array, 4), &
          SIZE(array, 5)):: ft
 
-    INTEGER ::  ishape(5)
+    INTEGER(iwp) ::  ishape(5)
 
 !
@@ -309,15 +303,15 @@
 !
 !-- Formal parameters
-    COMPLEX(fftkind), DIMENSION(:,:,:,:,:,:), INTENT(IN)           :: array
-    INTEGER,          DIMENSION(:),           INTENT(IN),  OPTIONAL:: dim
-    LOGICAL,                                  INTENT(IN),  OPTIONAL:: inv
-    INTEGER,                                  INTENT(OUT), OPTIONAL:: stat
+    COMPLEX(wp),  DIMENSION(:,:,:,:,:,:), INTENT(IN)           :: array
+    INTEGER(iwp), DIMENSION(:),           INTENT(IN),  OPTIONAL:: dim
+    INTEGER(iwp),                         INTENT(OUT), OPTIONAL:: stat
+    LOGICAL,                              INTENT(IN),  OPTIONAL:: inv
 !
 !-- Function result
-    COMPLEX(fftkind), DIMENSION( &
+    COMPLEX(wp), DIMENSION( &
          SIZE(array, 1), SIZE(array, 2), SIZE(array, 3), SIZE(array, 4), &
          SIZE(array, 5), SIZE(array, 6)):: ft
 
-    INTEGER ::  ishape(6)
+    INTEGER(iwp) ::  ishape(6)
 
 !
@@ -335,15 +329,15 @@
 !
 !-- Formal parameters
-    COMPLEX(fftkind), DIMENSION(:,:,:,:,:,:,:), INTENT(IN)           :: array
-    INTEGER,          DIMENSION(:),             INTENT(IN),  OPTIONAL:: dim
-    LOGICAL,                                    INTENT(IN),  OPTIONAL:: inv
-    INTEGER,                                    INTENT(OUT), OPTIONAL:: stat
+    COMPLEX(wp), DIMENSION(:,:,:,:,:,:,:), INTENT(IN)           :: array
+    INTEGER(iwp),          DIMENSION(:),   INTENT(IN),  OPTIONAL:: dim
+    INTEGER(iwp),                          INTENT(OUT), OPTIONAL:: stat
+    LOGICAL,                               INTENT(IN),  OPTIONAL:: inv
 !
 !-- Function result
-    COMPLEX(fftkind), DIMENSION( &
+    COMPLEX(wp), DIMENSION( &
          SIZE(array, 1), SIZE(array, 2), SIZE(array, 3), SIZE(array, 4), &
          SIZE(array, 5), SIZE(array, 6), SIZE(array, 7)):: ft
 
-    INTEGER ::  ishape(7)
+    INTEGER(iwp) ::  ishape(7)
 
 !
@@ -361,17 +355,17 @@
 !
 !-- Formal parameters
-    COMPLEX(fftkind), DIMENSION(*), INTENT(INOUT)        :: array
-    INTEGER,          DIMENSION(:), INTENT(IN)           :: shape
-    INTEGER,          DIMENSION(:), INTENT(IN),  OPTIONAL:: dim
-    LOGICAL,                        INTENT(IN),  OPTIONAL:: inv
-    INTEGER,                        INTENT(OUT), OPTIONAL:: stat
+    COMPLEX(wp),  DIMENSION(*), INTENT(INOUT)        :: array
+    INTEGER(iwp), DIMENSION(:), INTENT(IN)           :: shape
+    INTEGER(iwp), DIMENSION(:), INTENT(IN),  OPTIONAL:: dim
+    INTEGER(iwp),               INTENT(OUT), OPTIONAL:: stat
+    LOGICAL,                    INTENT(IN),  OPTIONAL:: inv
 !
 !-- Local arrays
-    INTEGER, DIMENSION(SIZE(shape)):: d
+    INTEGER(iwp), DIMENSION(SIZE(shape)):: d
 !
 !-- Local scalars
     LOGICAL      :: inverse
-    INTEGER      :: i, ndim, ntotal
-    REAL(fftkind):: scale
+    INTEGER(iwp) :: i, ndim, ntotal
+    REAL(wp):: scale
 !
 !-- Intrinsics used
@@ -394,8 +388,8 @@
 
     ntotal = PRODUCT(shape)
-    scale = SQRT(1.0_fftkind / PRODUCT(shape(d(1:ndim))))
+    scale = SQRT(1.0_wp / PRODUCT(shape(d(1:ndim))))
     DO i = 1, ntotal
        array(i) = CMPLX(REAL(array(i)) * scale, AIMAG(array(i)) * scale, &
-            KIND=fftkind)
+            KIND=wp)
     END DO
 
@@ -414,17 +408,17 @@
 !
 !-- Formal parameters
-    COMPLEX(fftkind), DIMENSION(*), INTENT(INOUT)        :: array
-    INTEGER,                        INTENT(IN)           :: ntotal, npass, nspan
-    LOGICAL,                        INTENT(IN)           :: inv
-    INTEGER,                        INTENT(OUT), OPTIONAL:: stat
+    COMPLEX(wp),  DIMENSION(*), INTENT(INOUT)        :: array
+    INTEGER(iwp),               INTENT(IN)           :: ntotal, npass, nspan
+    INTEGER(iwp),               INTENT(OUT), OPTIONAL:: stat
+    LOGICAL,                    INTENT(IN)           :: inv
 !
 !-- Local arrays
-    INTEGER,          DIMENSION(BIT_SIZE(0))     :: factor
-    COMPLEX(fftkind), DIMENSION(:), ALLOCATABLE  :: ctmp
-    REAL(fftkind),    DIMENSION(:), ALLOCATABLE  :: sine, cosine
-    INTEGER,          DIMENSION(:), ALLOCATABLE  :: perm
+    COMPLEX(wp),  DIMENSION(:), ALLOCATABLE  :: ctmp
+    INTEGER(iwp), DIMENSION(BIT_SIZE(0))     :: factor
+    INTEGER(iwp), DIMENSION(:), ALLOCATABLE  :: perm
+    REAL(wp),     DIMENSION(:), ALLOCATABLE  :: sine, cosine
 !
 !-- Local scalars
-    INTEGER         :: maxfactor, nfactor, nsquare, nperm
+    INTEGER(iwp)         :: maxfactor, nfactor, nsquare, nperm
 !
 !-- Intrinsics used
@@ -476,10 +470,10 @@
 !
 !--   Formal parameters
-      INTEGER,               INTENT(IN) :: npass
-      INTEGER, DIMENSION(*), INTENT(OUT):: factor
-      INTEGER,               INTENT(OUT):: nfactor, nsquare
+      INTEGER(iwp),               INTENT(IN) :: npass
+      INTEGER(iwp), DIMENSION(*), INTENT(OUT):: factor
+      INTEGER(iwp),               INTENT(OUT):: nfactor, nsquare
 !
 !--   Local scalars
-      INTEGER:: j, jj, k
+      INTEGER(iwp):: j, jj, k
 
       nfactor = 0
@@ -541,20 +535,20 @@
 !
 !--   Formal parameters
-      COMPLEX(fftkind), DIMENSION(*), INTENT(IN OUT):: array
-      INTEGER,                        INTENT(IN)    :: ntotal, npass, nspan
-      INTEGER,          DIMENSION(*), INTENT(IN)    :: factor
-      INTEGER,                        INTENT(IN)    :: nfactor
-      COMPLEX(fftkind), DIMENSION(*), INTENT(OUT)   :: ctmp
-      REAL(fftkind),    DIMENSION(*), INTENT(OUT)   :: sine, cosine
-      LOGICAL,                        INTENT(IN)    :: inv
+      COMPLEX(wp),  DIMENSION(*), INTENT(IN OUT):: array
+      COMPLEX(wp),  DIMENSION(*), INTENT(OUT)   :: ctmp
+      INTEGER(iwp),               INTENT(IN)    :: ntotal, npass, nspan
+      INTEGER(iwp), DIMENSION(*), INTENT(IN)    :: factor
+      INTEGER(iwp),               INTENT(IN)    :: nfactor
+      LOGICAL,                    INTENT(IN)    :: inv
+      REAL(wp),     DIMENSION(*), INTENT(OUT)   :: sine, cosine
 !
 !--   Local scalars
-      INTEGER         :: ii, ispan
-      INTEGER         :: j, jc, jf, jj
-      INTEGER         :: k, kk, kspan, k1, k2, k3, k4
-      INTEGER         :: nn, nt
-      REAL(fftkind)   :: s60, c72, s72, pi2, radf
-      REAL(fftkind)   :: c1, s1, c2, s2, c3, s3, cd, sd, ak
-      COMPLEX(fftkind):: cc, cj, ck, cjp, cjm, ckp, ckm
+      INTEGER(iwp):: ii, ispan
+      INTEGER(iwp):: j, jc, jf, jj
+      INTEGER(iwp):: k, kk, kspan, k1, k2, k3, k4
+      INTEGER(iwp):: nn, nt
+      REAL(wp)    :: s60, c72, s72, pi2, radf
+      REAL(wp)    :: c1, s1, c2, s2, c3, s3, cd, sd, ak
+      COMPLEX(wp) :: cc, cj, ck, cjp, cjm, ckp, ckm
 
       c72 = cos72
@@ -574,5 +568,5 @@
       jc = nspan / npass
       radf = pi2 * jc
-      pi2 = pi2 * 2.0_fftkind !-- use 2 PI from here on
+      pi2 = pi2 * 2.0_wp !-- use 2 PI from here on
 
       ii = 0
@@ -581,5 +575,5 @@
          sd = radf / kspan
          cd = SIN(sd)
-         cd = 2.0_fftkind * cd * cd
+         cd = 2.0_wp * cd * cd
          sd = SIN(sd + sd)
          kk = 1
@@ -606,5 +600,5 @@
             IF (kk > kspan) RETURN
             DO
-               c1 = 1.0_fftkind - cd
+               c1 = 1.0_wp - cd
                s1 = sd
                DO
@@ -614,5 +608,5 @@
                         ck = array(kk) - array(k2)
                         array(kk) = array(kk) + array(k2)
-                        array(k2) = ck * CMPLX(c1, s1, KIND=fftkind)
+                        array(k2) = ck * CMPLX(c1, s1, KIND=wp)
                         kk = k2 + kspan
                         IF (kk >= nt) EXIT
@@ -625,5 +619,5 @@
                   ak = c1 - (cd * c1 + sd * s1)
                   s1 = sd * c1 - cd * s1 + s1
-                  c1 = 2.0_fftkind - (ak * ak + s1 * s1)
+                  c1 = 2.0_wp - (ak * ak + s1 * s1)
                   s1 = s1 * c1
                   c1 = c1 * ak
@@ -641,6 +635,6 @@
 
             DO
-               c1 = 1.0_fftkind
-               s1 = 0.0_fftkind
+               c1 = 1.0_wp
+               s1 = 0.0_wp
                DO
                   DO
@@ -655,20 +649,20 @@
                      cjp = ckp - cjp
                      IF (inv) THEN
-                        ckp = ckm + CMPLX(-AIMAG(cjm), REAL(cjm), KIND=fftkind)
-                        ckm = ckm + CMPLX(AIMAG(cjm), -REAL(cjm), KIND=fftkind)
+                        ckp = ckm + CMPLX(-AIMAG(cjm), REAL(cjm), KIND=wp)
+                        ckm = ckm + CMPLX(AIMAG(cjm), -REAL(cjm), KIND=wp)
                      ELSE
-                        ckp = ckm + CMPLX(AIMAG(cjm), -REAL(cjm), KIND=fftkind)
-                        ckm = ckm + CMPLX(-AIMAG(cjm), REAL(cjm), KIND=fftkind)
+                        ckp = ckm + CMPLX(AIMAG(cjm), -REAL(cjm), KIND=wp)
+                        ckm = ckm + CMPLX(-AIMAG(cjm), REAL(cjm), KIND=wp)
                      END IF
 !
 !--                  Avoid useless multiplies
-                     IF (s1 == 0.0_fftkind) THEN
+                     IF (s1 == 0.0_wp) THEN
                         array(k1) = ckp
                         array(k2) = cjp
                         array(k3) = ckm
                      ELSE
-                        array(k1) = ckp * CMPLX(c1, s1, KIND=fftkind)
-                        array(k2) = cjp * CMPLX(c2, s2, KIND=fftkind)
-                        array(k3) = ckm * CMPLX(c3, s3, KIND=fftkind)
+                        array(k1) = ckp * CMPLX(c1, s1, KIND=wp)
+                        array(k2) = cjp * CMPLX(c2, s2, KIND=wp)
+                        array(k3) = ckm * CMPLX(c3, s3, KIND=wp)
                      END IF
                      kk = k3 + kspan
@@ -678,5 +672,5 @@
                   c2 = c1 - (cd * c1 + sd * s1)
                   s1 = sd * c1 - cd * s1 + s1
-                  c1 = 2.0_fftkind - (c2 * c2 + s1 * s1)
+                  c1 = 2.0_wp - (c2 * c2 + s1 * s1)
                   s1 = s1 * c1
                   c1 = c1 * c2
@@ -684,5 +678,5 @@
 !--               Values of c2, c3, s2, s3 that will get used next time
                   c2 = c1 * c1 - s1 * s1
-                  s2 = 2.0_fftkind * c1 * s1
+                  s2 = 2.0_wp * c1 * s1
                   c3 = c2 * c1 - s2 * s1
                   s3 = c2 * s1 + s2 * c1
@@ -712,13 +706,13 @@
                      array(kk) = ck + cj
                      ck = ck - CMPLX( &
-                          0.5_fftkind * REAL (cj), &
-                          0.5_fftkind * AIMAG(cj), &
-                          KIND=fftkind)
+                          0.5_wp * REAL (cj), &
+                          0.5_wp * AIMAG(cj), &
+                          KIND=wp)
                      cj = CMPLX( &
                           (REAL (array(k1)) - REAL (array(k2))) * s60, &
                           (AIMAG(array(k1)) - AIMAG(array(k2))) * s60, &
-                          KIND=fftkind)
-                     array(k1) = ck + CMPLX(-AIMAG(cj), REAL(cj), KIND=fftkind)
-                     array(k2) = ck + CMPLX(AIMAG(cj), -REAL(cj), KIND=fftkind)
+                          KIND=wp)
+                     array(k1) = ck + CMPLX(-AIMAG(cj), REAL(cj), KIND=wp)
+                     array(k2) = ck + CMPLX(AIMAG(cj), -REAL(cj), KIND=wp)
                      kk = k2 + kspan
                      IF (kk >= nn) EXIT
@@ -730,5 +724,5 @@
             CASE (5) !-- transform for factor of 5 (optional code)
                c2 = c72 * c72 - s72 * s72
-               s2 = 2.0_fftkind * c72 * s72
+               s2 = 2.0_wp * c72 * s72
                DO
                   DO
@@ -744,23 +738,23 @@
                      array(kk) = cc + ckp + cjp
                      ck = CMPLX(REAL(ckp) * c72, AIMAG(ckp) * c72, &
-                          KIND=fftkind) + &
+                          KIND=wp) + &
                           CMPLX(REAL(cjp) * c2,  AIMAG(cjp) * c2,  &
-                          KIND=fftkind) + cc
+                          KIND=wp) + cc
                      cj = CMPLX(REAL(ckm) * s72, AIMAG(ckm) * s72, &
-                          KIND=fftkind) + &
+                          KIND=wp) + &
                           CMPLX(REAL(cjm) * s2,  AIMAG(cjm) * s2,  &
-                          KIND=fftkind)
-                     array(k1) = ck + CMPLX(-AIMAG(cj), REAL(cj), KIND=fftkind)
-                     array(k4) = ck + CMPLX(AIMAG(cj), -REAL(cj), KIND=fftkind)
+                          KIND=wp)
+                     array(k1) = ck + CMPLX(-AIMAG(cj), REAL(cj), KIND=wp)
+                     array(k4) = ck + CMPLX(AIMAG(cj), -REAL(cj), KIND=wp)
                      ck = CMPLX(REAL(ckp) * c2,  AIMAG(ckp) * c2,  &
-                          KIND=fftkind) + &
+                          KIND=wp) + &
                           CMPLX(REAL(cjp) * c72, AIMAG(cjp) * c72, &
-                          KIND=fftkind) + cc
+                          KIND=wp) + cc
                      cj = CMPLX(REAL(ckm) * s2,  AIMAG(ckm) * s2,  &
-                          KIND=fftkind) - &
+                          KIND=wp) - &
                           CMPLX(REAL(cjm) * s72, AIMAG(cjm) * s72, &
-                          KIND=fftkind)
-                     array(k2) = ck + CMPLX(-AIMAG(cj), REAL(cj), KIND=fftkind)
-                     array(k3) = ck + CMPLX(AIMAG(cj), -REAL(cj), KIND=fftkind)
+                          KIND=wp)
+                     array(k2) = ck + CMPLX(-AIMAG(cj), REAL(cj), KIND=wp)
+                     array(k3) = ck + CMPLX(AIMAG(cj), -REAL(cj), KIND=wp)
                      kk = k4 + kspan
                      IF (kk >= nn) EXIT
@@ -776,6 +770,6 @@
                   c1 = COS(s1)
                   s1 = SIN(s1)
-                  cosine (jf) = 1.0_fftkind
-                  sine (jf) = 0.0_fftkind
+                  cosine (jf) = 1.0_wp
+                  sine (jf) = 0.0_wp
                   j = 1
                   DO
@@ -816,5 +810,5 @@
                         jj = j
                         ck = cc
-                        cj = (0.0_fftkind, 0.0_fftkind)
+                        cj = (0.0_wp, 0.0_wp)
                         k = 1
                         DO
@@ -822,9 +816,9 @@
                            ck = ck + CMPLX( &
                                 REAL (ctmp(k)) * cosine(jj), &
-                                AIMAG(ctmp(k)) * cosine(jj), KIND=fftkind)
+                                AIMAG(ctmp(k)) * cosine(jj), KIND=wp)
                            k = k + 1
                            cj = cj + CMPLX( &
                                 REAL (ctmp(k)) * sine(jj), &
-                                AIMAG(ctmp(k)) * sine(jj), KIND=fftkind)
+                                AIMAG(ctmp(k)) * sine(jj), KIND=wp)
                            jj = jj + j
                            IF (jj > jf) jj = jj - jf
@@ -833,7 +827,7 @@
                         k = jf - j
                         array(k1) = ck + CMPLX(-AIMAG(cj), REAL(cj), &
-                             KIND=fftkind)
+                             KIND=wp)
                         array(k2) = ck + CMPLX(AIMAG(cj), -REAL(cj), &
-                             KIND=fftkind)
+                             KIND=wp)
                         j = j + 1
                         IF (j >= k) EXIT
@@ -852,5 +846,5 @@
             kk = jc + 1
             DO
-               c2 = 1.0_fftkind - cd
+               c2 = 1.0_wp - cd
                s1 = sd
                DO
@@ -860,5 +854,5 @@
                   DO
                      DO
-                        array(kk) = CMPLX(c2, s2, KIND=fftkind) * array(kk)
+                        array(kk) = CMPLX(c2, s2, KIND=wp) * array(kk)
                         kk = kk + ispan
                         IF (kk > nt) EXIT
@@ -872,5 +866,5 @@
                   c2 = c1 - (cd * c1 + sd * s1)
                   s1 = s1 + sd * c1 - cd * s1
-                  c1 = 2.0_fftkind - (c2 * c2 + s1 * s1)
+                  c1 = 2.0_wp - (c2 * c2 + s1 * s1)
                   s1 = s1 * c1
                   c2 = c2 * c1
@@ -892,19 +886,18 @@
 !
 !--   Formal parameters
-      COMPLEX(fftkind), DIMENSION(*), INTENT(IN OUT):: array
-      INTEGER,                        INTENT(IN)    :: ntotal, npass, nspan
-      INTEGER,          DIMENSION(*), INTENT(IN OUT):: factor
-      INTEGER,                        INTENT(IN)    :: nfactor, nsquare
-      INTEGER,                        INTENT(IN)    :: maxfactor
-      COMPLEX(fftkind), DIMENSION(*), INTENT(OUT)   :: ctmp
-      INTEGER,          DIMENSION(*), INTENT(OUT)   :: perm
+      COMPLEX(wp),  DIMENSION(*), INTENT(IN OUT):: array
+      COMPLEX(wp),  DIMENSION(*), INTENT(OUT)   :: ctmp
+      INTEGER(iwp),               INTENT(IN)    :: ntotal, npass, nspan
+      INTEGER(iwp), DIMENSION(*), INTENT(IN OUT):: factor
+      INTEGER(iwp),               INTENT(IN)    :: nfactor, nsquare
+      INTEGER(iwp),               INTENT(IN)    :: maxfactor
+      INTEGER(iwp), DIMENSION(*), INTENT(OUT)   :: perm
 !
 !--   Local scalars
-      INTEGER         :: ii, ispan
-      INTEGER         :: j, jc, jj
-      INTEGER         :: k, kk, kspan, kt, k1, k2, k3
-      INTEGER         :: nn, nt
-      COMPLEX(fftkind):: ck
-
+      COMPLEX(wp) :: ck
+      INTEGER(iwp):: ii, ispan
+      INTEGER(iwp):: j, jc, jj
+      INTEGER(iwp):: k, kk, kspan, kt, k1, k2, k3
+      INTEGER(iwp):: nn, nt
 !
 !--   Permute the results to normal order---done in two stages
Index: /palm/trunk/SOURCE/sor.f90
===================================================================
--- /palm/trunk/SOURCE/sor.f90	(revision 1319)
+++ /palm/trunk/SOURCE/sor.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements
 !
 ! Former revisions:
@@ -28,21 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 707 2011-03-29 11:39:40Z raasch
-! bc_lr/ns replaced by bc_lr/ns_cyc
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng.
-! Call of exchange_horiz are modified.
-! bug removed in declaration of ddzw(), nz replaced by nzt+1
-!
-! 75 2007-03-22 09:54:05Z raasch
-! 2nd+3rd argument removed from exchange horiz
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.9  2005/03/26 21:02:23  raasch
-! Implementation of non-cyclic (Neumann) horizontal boundary conditions,
-! dx2,dy2 replaced by ddx2,ddy2
 !
 ! Revision 1.1  1997/08/11 06:25:56  raasch
@@ -55,16 +44,37 @@
 !------------------------------------------------------------------------------!
 
-    USE grid_variables
-    USE indices
-    USE pegrid
-    USE control_parameters
+    USE grid_variables,                                                        &
+        ONLY:  ddx2, ddy2
+
+    USE indices,                                                               &
+        ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nz, nzb, nzt
+
+    USE kinds
+
+    USE control_parameters,                                                    &
+        ONLY:  bc_lr_cyc, bc_ns_cyc, ibc_p_b, ibc_p_t, inflow_l, inflow_n,     &
+               inflow_r, inflow_s, n_sor, omega_sor, outflow_l, outflow_n,     &
+               outflow_r, outflow_s
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, n, nxl1, nxl2, nys1, nys2
-    REAL    ::  ddzu(1:nz+1), ddzw(1:nzt+1)
-    REAL    ::  d(nzb+1:nzt,nys:nyn,nxl:nxr),         &
-                p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)
-    REAL, DIMENSION(:), ALLOCATABLE ::  f1, f2, f3
+    INTEGER(iwp) ::  i              !:
+    INTEGER(iwp) ::  j              !:
+    INTEGER(iwp) ::  k              !:
+    INTEGER(iwp) ::  n              !:
+    INTEGER(iwp) ::  nxl1           !:
+    INTEGER(iwp) ::  nxl2           !:
+    INTEGER(iwp) ::  nys1           !:
+    INTEGER(iwp) ::  nys2           !:
+
+    REAL(wp)     ::  ddzu(1:nz+1)   !:
+    REAL(wp)     ::  ddzw(1:nzt+1)  !:
+
+    REAL(wp)     ::  d(nzb+1:nzt,nys:nyn,nxl:nxr)      !:
+    REAL(wp)     ::  p(nzb:nzt+1,nysg:nyng,nxlg:nxrg)  !:
+
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  f1         !:
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  f2         !:
+    REAL(wp), DIMENSION(:), ALLOCATABLE ::  f3         !:
 
     ALLOCATE( f1(1:nz), f2(1:nz), f3(1:nz) )
Index: /palm/trunk/SOURCE/subsidence.f90
===================================================================
--- /palm/trunk/SOURCE/subsidence.f90	(revision 1319)
+++ /palm/trunk/SOURCE/subsidence.f90	(revision 1320)
@@ -20,4 +20,11 @@
 ! Current revisions:
 ! -----------------
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -27,15 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 671 2011-01-11 12:04:00Z heinze $
-! bugfix: access to ddzu(nzt+2) which is not defined
-!
-! 667 2010-12-23 12:06:00Z suehring
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 580 2010-10-05 13:59:11Z heinze
-! Renaming of ws_vertical_gradient to subs_vertical_gradient,
-! ws_vertical_gradient_level to subs_vertical_gradient_level and
-! ws_vertical_gradient_level_ind to subs_vertical_gradient_level_i
 !
 ! Revision 3.7 2009-12-11 14:15:58Z heinze
@@ -68,15 +64,23 @@
     SUBROUTINE init_w_subsidence 
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE pegrid
-       USE statistics 
+       USE arrays_3d,                                                          &
+           ONLY:  dzu, w_subs, zu
+
+       USE control_parameters,                                                 &
+           ONLY:  message_string, ocean, subs_vertical_gradient,               &
+                  subs_vertical_gradient_level, subs_vertical_gradient_level_i
+
+       USE indices,                                                            &
+           ONLY:  nzb, nzt
+
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER :: i, k
-       REAL    :: gradient, ws_surface
+       INTEGER(iwp) ::  i !: 
+       INTEGER(iwp) ::  k !: 
+
+       REAL(wp)     ::  gradient   !: 
+       REAL(wp)     ::  ws_surface !: 
 
        IF ( .NOT. ALLOCATED( w_subs )) THEN
@@ -132,19 +136,28 @@
     SUBROUTINE subsidence( tendency, var, var_init ) 
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE pegrid
-       USE statistics 
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, w_subs
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_3d
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzb_s_inner,&
+                  nzt
+
+       USE kinds
 
        IMPLICIT NONE
  
-       INTEGER :: i, j, k
-
-       REAL :: tmp_grad
+       INTEGER(iwp) ::  i !: 
+       INTEGER(iwp) ::  j !: 
+       INTEGER(iwp) ::  k !: 
+
+       REAL(wp)     ::  tmp_grad !: 
     
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: var, tendency
-       REAL, DIMENSION(nzb:nzt+1) :: var_init, var_mod
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var      !: 
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  tendency !: 
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_init                     !: 
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_mod                      !: 
 
        var_mod = var_init
@@ -208,19 +221,27 @@
  SUBROUTINE subsidence_ij( i, j, tendency, var, var_init ) 
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE pegrid
-       USE statistics 
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu, w_subs
+
+       USE control_parameters,                                                 &
+           ONLY:  dt_3d
+
+       USE indices,                                                            &
+           ONLY:  nxl, nxlg, nxrg, nyng, nys, nysg, nzb_s_inner, nzb, nzt
+
+       USE kinds
 
        IMPLICIT NONE
  
-       INTEGER :: i, j, k
-
-       REAL :: tmp_grad
+       INTEGER(iwp) ::  i !: 
+       INTEGER(iwp) ::  j !: 
+       INTEGER(iwp) ::  k !: 
+
+       REAL(wp)     ::  tmp_grad !: 
     
-       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: var, tendency
-       REAL, DIMENSION(nzb:nzt+1) :: var_init, var_mod
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  var      !: 
+       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  tendency !: 
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_init                     !: 
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  var_mod                      !: 
 
        var_mod = var_init
Index: /palm/trunk/SOURCE/sum_up_3d_data.f90
===================================================================
--- /palm/trunk/SOURCE/sum_up_3d_data.f90	(revision 1319)
+++ /palm/trunk/SOURCE/sum_up_3d_data.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -44,27 +50,4 @@
 ! 978 2012-08-09 08:28:32Z fricke
 ! +z0h*
-!
-! 790 2011-11-29 03:11:20Z raasch
-! bugfix: calculation of 'pr' must depend on the particle weighting factor
-!
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt_av
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 402 2009-10-21 11:59:41Z maronga
-! Bugfix in calculation of shf*_av, qsws*_av
-!
-! 2009-08-25 08:35:52Z maronga
-! +shf*, qsws*
-!
-! 96 2007-06-04 08:07:41Z raasch
-! +sum-up of density and salinity
-!
-! 72 2007-03-19 08:20:46Z raasch
-! +sum-up of precipitation rate and roughness length (prr*, z0*)
-!
-! RCS Log replace by Id keyword, revision history cleaned up
 !
 ! Revision 1.1  2006/02/23 12:55:23  raasch
@@ -78,18 +61,43 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE averaging
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE indices
-    USE particle_attributes
+    USE arrays_3d,                                                             &
+        ONLY:  dzw, e, nr, p, pt, q, qc, ql, ql_c, ql_v, qr, qsws, rho, sa,    &
+               shf, ts, u, us, v, vpt, w, z0, z0h
+
+    USE averaging,                                                             &
+        ONLY:  e_av, lpt_av, lwp_av, nr_av, p_av, pc_av, pr_av, prr_av,        &
+               precipitation_rate_av, pt_av, q_av, qc_av, ql_av, ql_c_av,      &
+               ql_v_av, ql_vp_av, qr_av, qsws_av, qv_av, rho_av, s_av, sa_av,  &
+               shf_av, ts_av, u_av, us_av, v_av, vpt_av, w_av, z0_av, z0h_av
+
+    USE cloud_parameters,                                                      &
+        ONLY:  l_d_cp, precipitation_rate, pt_d_t 
+
+    USE control_parameters,                                                    &
+        ONLY:  average_count_3d, cloud_physics, doav, doav_n
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt 
+
+    USE kinds
+
+    USE particle_attributes,                                                   &
+        ONLY:  particles, prt_count, prt_start_index
 
     IMPLICIT NONE
 
-    INTEGER ::  i, ii, j, k, n, psi
-
-    REAL    ::  mean_r, s_r3, s_r4
-
+    INTEGER(iwp) ::  i   !: 
+    INTEGER(iwp) ::  ii  !: 
+    INTEGER(iwp) ::  j   !: 
+    INTEGER(iwp) ::  k   !: 
+    INTEGER(iwp) ::  n   !: 
+    INTEGER(iwp) ::  psi !: 
+
+    REAL(wp)     ::  mean_r !: 
+    REAL(wp)     ::  s_r3   !: 
+    REAL(wp)     ::  s_r4   !: 
 
     CALL cpu_log (log_point(34),'sum_up_3d_data','start')
Index: /palm/trunk/SOURCE/surface_coupler.f90
===================================================================
--- /palm/trunk/SOURCE/surface_coupler.f90	(revision 1319)
+++ /palm/trunk/SOURCE/surface_coupler.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -37,20 +43,4 @@
 ! 880 2012-04-13 06:28:59Z raasch
 ! Bugfix: preprocessor statements for parallel execution added
-!
-! 709 2011-03-30 09:31:40Z raasch
-! formatting adjustments
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Additional case for nonequivalent processor and grid topopolgy in ocean and 
-! atmosphere added (coupling_topology = 1).
-! Added exchange of u and v from Ocean to Atmosphere
-!
-! 291 2009-04-16 12:07:26Z raasch
-! Coupling with independent precursor runs.
-! Output of messages replaced by message handling routine.
-!
-! 206 2008-10-13 14:59:11Z raasch
-! Implementation of a MPI-1 Coupling: replaced myid with target_id,
-! deleted __mpi2 directives
 !
 ! 109 2007-08-28 15:26:47Z letzel
@@ -62,15 +52,28 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  pt, shf, qsws, qswst_remote, rho, sa, saswst, total_2d_a,       &
+               total_2d_o, tswst, u, usws, uswst, v, vsws, vswst
+
+    USE control_parameters,                                                    &
+        ONLY:  coupling_mode, coupling_mode_remote, coupling_topology,         &
+               humidity, humidity_remote, message_string, terminate_coupled,   &
+               terminate_coupled_remote, time_since_reference_point
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE indices,                                                               &
+        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, nx_a, nx_o, ny, nyn, nyng, nys, &
+               nysg, ny_a, ny_o, nzt
+
+    USE kinds
+
     USE pegrid
 
     IMPLICIT NONE
 
-    REAL    ::  time_since_reference_point_rem
-    REAL    ::  total_2d(-nbgp:ny+nbgp,-nbgp:nx+nbgp)
+    REAL(wp)    ::  time_since_reference_point_rem        !: 
+    REAL(wp)    ::  total_2d(-nbgp:ny+nbgp,-nbgp:nx+nbgp) !: 
 
 #if defined( __parallel )
@@ -418,14 +421,28 @@
 #if defined( __parallel )
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
-    USE pegrid
+    USE arrays_3d,                                                             &
+        ONLY:  total_2d_a, total_2d_o
+
+    USE indices,                                                               &
+        ONLY:  nbgp, nx, nx_a, nx_o, ny, ny_a, ny_o
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  comm2d, comm_inter, ierr, MPI_DOUBLE_PRECISION, myid, ngp_a,    &
+               target_id
 
     IMPLICIT NONE
 
-    INTEGER             ::  dnx, dnx2, dny, dny2, i, ii, j, jj
-    INTEGER, intent(in) ::  tag
+    INTEGER(iwp) ::  dnx  !: 
+    INTEGER(iwp) ::  dnx2 !: 
+    INTEGER(iwp) ::  dny  !: 
+    INTEGER(iwp) ::  dny2 !: 
+    INTEGER(iwp) ::  i    !: 
+    INTEGER(iwp) ::  ii   !: 
+    INTEGER(iwp) ::  j    !: 
+    INTEGER(iwp) ::  jj   !: 
+
+    INTEGER(iwp), intent(in) ::  tag !: 
 
     CALL MPI_BARRIER( comm2d, ierr )
@@ -490,16 +507,30 @@
 #if defined( __parallel )
 
-    USE arrays_3d
-    USE control_parameters
-    USE grid_variables
-    USE indices
-    USE pegrid
+    USE arrays_3d,                                                             &
+        ONLY:  total_2d_a, total_2d_o
+
+    USE indices,                                                               &
+        ONLY:  nbgp, nx, nx_a, nx_o, ny, ny_a, ny_o
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  comm2d, comm_inter, ierr, MPI_DOUBLE_PRECISION, myid, ngp_o,    &
+               target_id
 
     IMPLICIT NONE
 
-    INTEGER             ::  dnx, dny, i, ii, j, jj
-    INTEGER, intent(in) ::  tag
-    REAL                ::  fl, fr, myl, myr
-
+    INTEGER(iwp)             ::  dnx !: 
+    INTEGER(iwp)             ::  dny !: 
+    INTEGER(iwp)             ::  i   !: 
+    INTEGER(iwp)             ::  ii  !: 
+    INTEGER(iwp)             ::  j   !: 
+    INTEGER(iwp)             ::  jj  !: 
+    INTEGER(iwp), intent(in) ::  tag !: 
+
+    REAL(wp)                 ::  fl  !: 
+    REAL(wp)                 ::  fr  !: 
+    REAL(wp)                 ::  myl !: 
+    REAL(wp)                 ::  myr !: 
 
     CALL MPI_BARRIER( comm2d, ierr )
Index: /palm/trunk/SOURCE/swap_timelevel.f90
===================================================================
--- /palm/trunk/SOURCE/swap_timelevel.f90	(revision 1319)
+++ /palm/trunk/SOURCE/swap_timelevel.f90	(revision 1320)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! revision history before 2012 removed,
 !
 ! Former revisions:
@@ -50,21 +51,4 @@
 ! all actions concerning leapfrog scheme removed
 !
-! 102 2007-07-27 09:09:17Z raasch
-! swaping of uswst, vswst included
-!
-! 95 2007-06-02 16:48:38Z raasch
-! Swaping of salinity
-!
-! 75 2007-03-22 09:54:05Z raasch
-! moisture renamed humidity
-!
-! 19 2007-02-23 04:53:48Z raasch
-! Swaping of top fluxes
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.8  2004/01/28 15:28:18  raasch
-! Swaping for Runge-Kutta schemes implemented
-!
 ! Revision 1.1  2000/01/10  10:08:58  10:08:58  raasch (Siegfried Raasch)
 ! Initial revision
@@ -76,7 +60,15 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE cpulog
-    USE control_parameters
+    USE arrays_3d,                                                             &
+        ONLY:  e, e_1, e_2, e_p, nr, nr_1, nr_2, nr_p, pt, pt_1, pt_2, pt_p, q,&
+               q_1, q_2, q_p, qr, qr_1, qr_2, qr_p, sa, sa_1, sa_2, sa_p, u,   &
+               u_1, u_2, u_p, v, v_1, v_2, v_p, w, w_1, w_2, w_p
+
+    USE cpulog,                                                                &
+        ONLY: cpu_log, log_point
+
+    USE control_parameters,                                                    &
+        ONLY:  cloud_physics, constant_diffusion, humidity, icloud_scheme,     &
+               neutral, ocean, passive_scalar, precipitation, timestep_count
 
     IMPLICIT NONE
Index: /palm/trunk/SOURCE/temperton_fft.f90
===================================================================
--- /palm/trunk/SOURCE/temperton_fft.f90	(revision 1319)
+++ /palm/trunk/SOURCE/temperton_fft.f90	(revision 1320)
@@ -4,18 +4,15 @@
 ! Current revisions:
 ! -----------------
-! 
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
 ! -----------------
 ! $Id$
-!
-! 258 2009-03-13 12:36:03Z heinze
-! Output of messages replaced by message handling routine.
-!
-! Feb. 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.2  2003/04/16 12:49:25  raasch
-! Abort in case of illegal factors
 !
 ! Revision 1.1  2003/03/12 16:41:59  raasch
@@ -28,4 +25,6 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+
     IMPLICIT NONE
 
@@ -35,16 +34,16 @@
 
 
-    INTEGER           ::  nfax(10)   !  array used by *fft991*.
-    REAL, ALLOCATABLE ::  trig(:)    !  array used by *fft991*.
+    INTEGER(iwp)          ::  nfax(10)   !: array used by *fft991*.
+    REAL(wp), ALLOCATABLE ::  trig(:)    !: array used by *fft991*.
 
 !
 !-- nfft: maximum length of calls to *fft.
 #if defined( __nec )
-    INTEGER, PARAMETER ::  nfft = 256
+    INTEGER(iwp), PARAMETER ::  nfft = 256  !: 
 #else
-    INTEGER, PARAMETER ::  nfft =  32
+    INTEGER(iwp), PARAMETER ::  nfft =  32  !: 
 #endif
 
-    INTEGER, PARAMETER ::  nout =   6  ! standard output stream
+    INTEGER(iwp), PARAMETER ::  nout =   6  !: standard output stream
 
 CONTAINS
@@ -99,20 +98,45 @@
     ! dimension a(n),work(n),trigs(n),ifax(1)
 
+    USE kinds
 
     IMPLICIT NONE
 
     !  Scalar arguments 
-    INTEGER :: inc, isign, jump, lot, n
+    INTEGER(iwp) ::  inc   !: 
+    INTEGER(iwp) ::  isign !: 
+    INTEGER(iwp) ::  jump  !: 
+    INTEGER(iwp) ::  lot   !: 
+    INTEGER(iwp) ::  n     !: 
 
     !  Array arguments 
-    REAL :: a(*), trigs(*), work(*)
-    INTEGER :: ifax(*)
+    REAL(wp)     ::  a(*)     !: 
+    REAL(wp)     ::  trigs(*) !: 
+    REAL(wp)     ::  work(*)  !: 
+    INTEGER(iwp) ::  ifax(*)  !: 
 
     !  Local scalars: 
-    INTEGER :: i, ia, ibase, ierr, ifac, igo, ii, istart, ix, iz, j, jbase, jj, &
-         &      k, la, nb, nblox, nfax, nvex, nx
+    INTEGER(iwp) ::  i      !: 
+    INTEGER(iwp) ::  ia     !: 
+    INTEGER(iwp) ::  ibase  !: 
+    INTEGER(iwp) ::  ierr   !: 
+    INTEGER(iwp) ::  ifac   !: 
+    INTEGER(iwp) ::  igo    !: 
+    INTEGER(iwp) ::  ii     !: 
+    INTEGER(iwp) ::  istart !: 
+    INTEGER(iwp) ::  ix     !: 
+    INTEGER(iwp) ::  iz     !: 
+    INTEGER(iwp) ::  j      !: 
+    INTEGER(iwp) ::  jbase  !: 
+    INTEGER(iwp) ::  jj     !: 
+    INTEGER(iwp) ::  k      !: 
+    INTEGER(iwp) ::  la     !: 
+    INTEGER(iwp) ::  nb     !: 
+    INTEGER(iwp) ::  nblox  !: 
+    INTEGER(iwp) ::  nfax   !: 
+    INTEGER(iwp) ::  nvex   !: 
+    INTEGER(iwp) ::  nx     !: 
 
     !  Intrinsic functions 
-    INTRINSIC MOD
+!    INTRINSIC MOD
 
 
@@ -316,28 +340,112 @@
     !
 
-    IMPLICIT NONE
+    USE kinds
+
+    IMPLICIT NONE 
 
     !  Scalar arguments 
-    INTEGER :: ierr, ifac, inc1, inc2, inc3, inc4, la, lot, n
+    INTEGER(iwp) ::  ierr !: 
+    INTEGER(iwp) ::  ifac !: 
+    INTEGER(iwp) ::  inc1 !: 
+    INTEGER(iwp) ::  inc2 !: 
+    INTEGER(iwp) ::  inc3 !: 
+    INTEGER(iwp) ::  inc4 !: 
+    INTEGER(iwp) ::  la   !: 
+    INTEGER(iwp) ::  lot  !: 
+    INTEGER(iwp) ::  n    !: 
 
     !  Array arguments 
     ! REAL :: a(n),b(n),c(n),d(n),trigs(n)
-    REAL :: a(*), b(*), c(*), d(*), trigs(*)
-
+    REAL(wp) ::  a(*)     !: 
+    REAL(wp) ::  b(*)     !: 
+    REAL(wp) ::  c(*)     !: 
+    REAL(wp) ::  d(*)     !: 
+    REAL(wp) ::  trigs(*) !:
+ 
     !  Local scalars: 
-    REAL :: a0, a1, a10, a11, a2, a20, a21, a3, a4, a5, a6, b0, b1, b10, b11, &
-         &      b2, b20, b21, b3, b4, b5, b6, c1, c2, c3, c4, c5, qrt5, s1, s2, s3, s4, &
-         &      s5, sin36, sin45, sin60, sin72, z, zqrt5, zsin36, zsin45, zsin60, &
-         &      zsin72
-    INTEGER :: i, ia, ib, ibad, ibase, ic, id, ie, if, ig, igo, ih, iink, ijk, &
-         &      ijump, j, ja, jb, jbase, jc, jd, je, jf, jink, k, kb, kc, kd, ke, kf, &
-         &      kstop, l, m
+    REAL(wp) ::  a0     !: 
+    REAL(wp) ::  a1     !: 
+    REAL(wp) ::  a10    !: 
+    REAL(wp) ::  a11    !: 
+    REAL(wp) ::  a2     !: 
+    REAL(wp) ::  a20    !: 
+    REAL(wp) ::  a21    !: 
+    REAL(wp) ::  a3     !: 
+    REAL(wp) ::  a4     !: 
+    REAL(wp) ::  a5     !: 
+    REAL(wp) ::  a6     !: 
+    REAL(wp) ::  b0     !: 
+    REAL(wp) ::  b1     !: 
+    REAL(wp) ::  b10    !: 
+    REAL(wp) ::  b11    !: 
+    REAL(wp) ::  b2     !: 
+    REAL(wp) ::  b20    !: 
+    REAL(wp) ::  b21    !: 
+    REAL(wp) ::  b3     !: 
+    REAL(wp) ::  b4     !: 
+    REAL(wp) ::  b5     !: 
+    REAL(wp) ::  b6     !: 
+    REAL(wp) ::  c1     !: 
+    REAL(wp) ::  c2     !: 
+    REAL(wp) ::  c3     !: 
+    REAL(wp) ::  c4     !: 
+    REAL(wp) ::  c5     !: 
+    REAL(wp) ::  qrt5   !: 
+    REAL(wp) ::  s1     !: 
+    REAL(wp) ::  s2     !: 
+    REAL(wp) ::  s3     !: 
+    REAL(wp) ::  s4     !: 
+    REAL(wp) ::  s5     !: 
+    REAL(wp) ::  sin36  !: 
+    REAL(wp) ::  sin45  !: 
+    REAL(wp) ::  sin60  !: 
+    REAL(wp) ::  sin72  !: 
+    REAL(wp) ::  z      !: 
+    REAL(wp) ::  zqrt5  !: 
+    REAL(wp) ::  zsin36 !: 
+    REAL(wp) ::  zsin45 !: 
+    REAL(wp) ::  zsin60 !: 
+    REAL(wp) ::  zsin72 !: 
+
+    INTEGER(iwp) ::  i     !: 
+    INTEGER(iwp) ::  ia    !: 
+    INTEGER(iwp) ::  ib    !: 
+    INTEGER(iwp) ::  ibad  !: 
+    INTEGER(iwp) ::  ibase !: 
+    INTEGER(iwp) ::  ic    !: 
+    INTEGER(iwp) ::  id    !: 
+    INTEGER(iwp) ::  ie    !: 
+    INTEGER(iwp) ::  if    !: 
+    INTEGER(iwp) ::  ig    !: 
+    INTEGER(iwp) ::  igo   !: 
+    INTEGER(iwp) ::  ih    !: 
+    INTEGER(iwp) ::  iink  !: 
+    INTEGER(iwp) ::  ijk   !: 
+    INTEGER(iwp) ::  ijump !: 
+    INTEGER(iwp) ::  j     !: 
+    INTEGER(iwp) ::  ja    !: 
+    INTEGER(iwp) ::  jb    !: 
+    INTEGER(iwp) ::  jbase !: 
+    INTEGER(iwp) ::  jc    !: 
+    INTEGER(iwp) ::  jd    !: 
+    INTEGER(iwp) ::  je    !: 
+    INTEGER(iwp) ::  jf    !: 
+    INTEGER(iwp) ::  jink  !: 
+    INTEGER(iwp) ::  k     !: 
+    INTEGER(iwp) ::  kb    !: 
+    INTEGER(iwp) ::  kc    !: 
+    INTEGER(iwp) ::  kd    !: 
+    INTEGER(iwp) ::  ke    !: 
+    INTEGER(iwp) ::  kf    !: 
+    INTEGER(iwp) ::  kstop !: 
+    INTEGER(iwp) ::  l     !: 
+    INTEGER(iwp) ::  m     !: 
 
     !  Intrinsic functions 
-    INTRINSIC REAL, SQRT
+!    INTRINSIC REAL, SQRT
 
     !  Data statements 
-    DATA sin36/0.587785252292473/, sin72/0.951056516295154/, &
-         &      qrt5/0.559016994374947/, sin60/0.866025403784437/
+    DATA sin36/0.587785252292473_wp/, sin72/0.951056516295154_wp/, &
+         &      qrt5/0.559016994374947_wp/, sin60/0.866025403784437_wp/
 
 
@@ -438,5 +546,5 @@
     GO TO 170
 30  CONTINUE
-    z = 1.0/REAL(n)
+    z = 1.0_wp/REAL(n)
     DO l = 1, la
        i = ibase
@@ -551,5 +659,5 @@
     GO TO 170
 60  CONTINUE
-    z = 1.0/REAL(n)
+    z = 1.0_wp/REAL(n)
     zsin60 = z*sin60
     DO l = 1, la
@@ -658,5 +766,5 @@
     IF (jb>jc) GO TO 170
 80  CONTINUE
-    sin45 = SQRT(0.5)
+    sin45 = SQRT(0.5_wp)
     jbase = 0
     DO l = 1, la
@@ -680,5 +788,5 @@
     GO TO 170
 90  CONTINUE
-    z = 1.0/REAL(n)
+    z = 1.0_wp/REAL(n)
     DO l = 1, la
        i = ibase
@@ -843,5 +951,5 @@
     GO TO 170
 120 CONTINUE
-    z = 1.0/REAL(n)
+    z = 1.0_wp/REAL(n)
     zqrt5 = z*qrt5
     zsin36 = z*sin36
@@ -1019,5 +1127,5 @@
     GO TO 170
 150 CONTINUE
-    z = 1.0/REAL(n)
+    z = 1.0_wp/REAL(n)
     zsin60 = z*sin60
     DO l = 1, la
@@ -1062,5 +1170,5 @@
     jd = jc + 2*m*inc2
     je = jd + 2*m*inc2
-    z = 1.0/REAL(n)
+    z = 1.0_wp/REAL(n)
     zsin45 = z*SQRT(0.5)
 
@@ -1105,29 +1213,98 @@
     ! Dimension a(n),b(n),c(n),d(n),trigs(n)
 
+    USE kinds
+
     IMPLICIT NONE
 
     !  Scalar arguments 
-    INTEGER :: ierr, ifac, inc1, inc2, inc3, inc4, la, lot, n
+    INTEGER(iwp) ::  ierr !: 
+    INTEGER(iwp) ::  ifac !: 
+    INTEGER(iwp) ::  inc1 !: 
+    INTEGER(iwp) ::  inc2 !: 
+    INTEGER(iwp) ::  inc3 !: 
+    INTEGER(iwp) ::  inc4 !: 
+    INTEGER(iwp) ::  la   !: 
+    INTEGER(iwp) ::  lot  !: 
+    INTEGER(iwp) ::  n    !: 
 
     !  Array arguments 
-    REAL :: a(*), b(*), c(*), d(*), trigs(*)
+    REAL(wp) ::  a(*)     !: 
+    REAL(wp) ::  b(*)     !: 
+    REAL(wp) ::  c(*)     !: 
+    REAL(wp) ::  d(*)     !: 
+    REAL(wp) ::  trigs(*) !: 
 
     !  Local scalars: 
-    REAL :: c1, c2, c3, c4, c5, qqrt5, qrt5, s1, s2, s3, s4, s5, sin36, sin45, &
-         &      sin60, sin72, ssin36, ssin45, ssin60, ssin72
-    INTEGER :: i, ia, ib, ibad, ibase, ic, id, ie, if, igo, iink, ijk, j, ja, &
-         &      jb, jbase, jc, jd, je, jf, jg, jh, jink, jump, k, kb, kc, kd, ke, kf, &
-         &      kstop, l, m
+    REAL(wp) ::  c1     !: 
+    REAL(wp) ::  c2     !: 
+    REAL(wp) ::  c3     !: 
+    REAL(wp) ::  c4     !: 
+    REAL(wp) ::  c5     !: 
+    REAL(wp) ::  qqrt5  !: 
+    REAL(wp) ::  qrt5   !: 
+    REAL(wp) ::  s1     !: 
+    REAL(wp) ::  s2     !: 
+    REAL(wp) ::  s3     !: 
+    REAL(wp) ::  s4     !: 
+    REAL(wp) ::  s5     !: 
+    REAL(wp) ::  sin36  !: 
+    REAL(wp) ::  sin45  !: 
+    REAL(wp) ::  sin60  !: 
+    REAL(wp) ::  sin72  !: 
+    REAL(wp) ::  ssin36 !: 
+    REAL(wp) ::  ssin45 !: 
+    REAL(wp) ::  ssin60 !: 
+    REAL(wp) ::  ssin72 !: 
+
+    INTEGER(iwp) ::  i     !: 
+    INTEGER(iwp) ::  ia    !: 
+    INTEGER(iwp) ::  ib    !: 
+    INTEGER(iwp) ::  ibad  !: 
+    INTEGER(iwp) ::  ibase !: 
+    INTEGER(iwp) ::  ic    !: 
+    INTEGER(iwp) ::  id    !: 
+    INTEGER(iwp) ::  ie    !: 
+    INTEGER(iwp) ::  if    !: 
+    INTEGER(iwp) ::  igo   !: 
+    INTEGER(iwp) ::  iink  !: 
+    INTEGER(iwp) ::  ijk   !: 
+    INTEGER(iwp) ::  j     !: 
+    INTEGER(iwp) ::  ja    !: 
+    INTEGER(iwp) ::  jb    !: 
+    INTEGER(iwp) ::  jbase !: 
+    INTEGER(iwp) ::  jc    !: 
+    INTEGER(iwp) ::  jd    !: 
+    INTEGER(iwp) ::  je    !: 
+    INTEGER(iwp) ::  jf    !: 
+    INTEGER(iwp) ::  jg    !: 
+    INTEGER(iwp) ::  jh    !: 
+    INTEGER(iwp) ::  jink  !: 
+    INTEGER(iwp) ::  jump  !: 
+    INTEGER(iwp) ::  k     !: 
+    INTEGER(iwp) ::  kb    !: 
+    INTEGER(iwp) ::  kc    !: 
+    INTEGER(iwp) ::  kd    !: 
+    INTEGER(iwp) ::  ke    !: 
+    INTEGER(iwp) ::  kf    !: 
+    INTEGER(iwp) ::  kstop !: 
+    INTEGER(iwp) ::  l     !: 
+    INTEGER(iwp) ::  m     !: 
 
     !  Local arrays: 
-    REAL :: a10(nfft), a11(nfft), a20(nfft), a21(nfft), b10(nfft), b11(nfft), b20(nfft), &
-         &      b21(nfft)
+    REAL(wp) ::  a10(nfft) !: 
+    REAL(wp) ::  a11(nfft) !: 
+    REAL(wp) ::  a20(nfft) !: 
+    REAL(wp) ::  a21(nfft) !: 
+    REAL(wp) ::  b10(nfft) !: 
+    REAL(wp) ::  b11(nfft) !: 
+    REAL(wp) ::  b20(nfft) !: 
+    REAL(wp) ::  b21(nfft) !: 
 
     !  Intrinsic functions 
-    INTRINSIC SQRT
+!    INTRINSIC SQRT
 
     !  Data statements 
-    DATA sin36/0.587785252292473/, sin72/0.951056516295154/, &
-         &      qrt5/0.559016994374947/, sin60/0.866025403784437/
+    DATA sin36/0.587785252292473_wp/, sin72/0.951056516295154_wp/, &
+         &      qrt5/0.559016994374947_wp/, sin60/0.866025403784437_wp/
 
 
@@ -1622,7 +1799,7 @@
     GO TO 170
 120 CONTINUE
-    qqrt5 = 2.0*qrt5
-    ssin36 = 2.0*sin36
-    ssin72 = 2.0*sin72
+    qqrt5 = 2.0_wp*qrt5
+    ssin36 = 2.0_wp*sin36
+    ssin72 = 2.0_wp*sin72
     DO l = 1, la
        i = ibase
@@ -1838,5 +2015,5 @@
     jg = jf + jink
     jh = jg + jink
-    ssin45 = SQRT(2.0)
+    ssin45 = SQRT(2.0_wp)
 
     DO l = 1, la
@@ -1889,25 +2066,38 @@
 
 
-    USE control_parameters
-    USE pegrid
+    USE control_parameters,                                                    &
+        ONLY:  message_string
+
+    USE kinds
 
     IMPLICIT NONE
 
     !  Scalar arguments 
-    INTEGER :: n
+    INTEGER(iwp) ::  n !: 
 
     !  Array arguments 
-    REAL :: trigs(*)
-    INTEGER :: ifax(*)
+    INTEGER(iwp) ::  ifax(*)  !: 
+    REAL(wp)     ::  trigs(*) !: 
+
 
     !  Local scalars: 
-    REAL :: angle, del
-    INTEGER :: i, ifac, ixxx, k, l, nfax, nhl, nil, nu
+    REAL(wp) ::  angle    !: 
+    REAL(wp) ::  del      !: 
+    INTEGER(iwp) ::  i    !: 
+    INTEGER(iwp) ::  ifac !: 
+    INTEGER(iwp) ::  ixxx !: 
+    INTEGER(iwp) ::  k    !: 
+    INTEGER(iwp) ::  l    !: 
+    INTEGER(iwp) ::  nfax !: 
+    INTEGER(iwp) ::  nhl  !: 
+    INTEGER(iwp) ::  nil  !: 
+    INTEGER(iwp) ::  nu   !: 
 
     !  Local arrays: 
-    INTEGER :: jfax(10), lfax(7)
+    INTEGER(iwp) ::  jfax(10) !: 
+    INTEGER(iwp) ::  lfax(7)  !: 
 
     !  Intrinsic functions 
-    INTRINSIC ASIN, COS, MOD, REAL, SIN
+!    INTRINSIC ASIN, COS, MOD, REAL, SIN
 
     !  Data statements 
@@ -1918,5 +2108,5 @@
     ixxx = 1
 
-    del = 4.0*ASIN(1.0)/REAL(n)
+    del = 4.0_wp*ASIN(1.0_wp)/REAL(n)
     nil = 0
     nhl = (n/2) - 1
Index: /palm/trunk/SOURCE/time_integration.f90
===================================================================
--- /palm/trunk/SOURCE/time_integration.f90	(revision 1319)
+++ /palm/trunk/SOURCE/time_integration.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -101,63 +107,4 @@
 ! wang_collision_kernel renamed wang_kernel
 !
-! 790 2011-11-29 03:11:20Z raasch
-! exchange of ghostpoints for array diss
-!
-! 707 2011-03-29 11:39:40Z raasch
-! bc_lr/ns replaced by bc_lr/ns_cyc, calls of exchange_horiz are modified,
-! adaption to sloping surface
-!
-! 667  2010-12-23 12:06:00Z suehring/gryschka
-! Calls of exchange_horiz are modified.
-! Adaption to slooping surface.
-!
-! 449 2010-02-02 11:23:59Z raasch
-! Bugfix: exchange of ghost points for prho included
-!
-! 410 2009-12-04 17:05:40Z letzel
-! masked data output
-!
-! 388 2009-09-23 09:40:33Z raasch
-! Using prho instead of rho in diffusvities.
-! Coupling with independent precursor runs.
-! Bugfix: output of particle time series only if particle advection is switched
-!         on
-!
-! 151 2008-03-07 13:42:18Z raasch
-! inflow turbulence is imposed by calling new routine inflow_turbulence
-!
-! 108 2007-08-24 15:10:38Z letzel
-! Call of new routine surface_coupler,
-! presure solver is called after the first Runge-Kutta substep instead of the
-! last in case that call_psolver_at_all_substeps = .F.; for this case, the
-! random perturbation has to be added to the velocity fields also after the
-! first substep
-!
-! 97 2007-06-21 08:23:15Z raasch
-! diffusivities is called with argument rho in case of ocean runs,
-! new argument pt_/prho_reference in calls of diffusivities,
-! ghostpoint exchange for salinity and density
-!
-! 87 2007-05-22 15:46:47Z raasch
-! var_hom renamed pr_palm
-!
-! 75 2007-03-22 09:54:05Z raasch
-! Move call of user_actions( 'after_integration' ) below increment of times
-! and counters,
-! calls of prognostic_equations_.. changed to .._noopt, .._cache, and
-! .._vector, these calls are now controlled by switch loop_optimization,
-! uxrp, vynp eliminated, 2nd+3rd argument removed from exchange horiz,
-! moisture renamed humidity
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.8  2006/08/22 14:16:05  raasch
-! Disturbances are imposed only for the last Runge-Kutta-substep
-!
-! Revision 1.2  2004/04/30 13:03:40  raasch
-! decalpha-specific warning removed, routine name changed to time_integration,
-! particle advection is carried out only once during the intermediate steps,
-! impulse_advec renamed momentum_advec
-!
 ! Revision 1.1  1997/08/11 06:19:04  raasch
 ! Initial revision
@@ -170,28 +117,86 @@
 !------------------------------------------------------------------------------!
 
-    USE advec_ws
-    USE arrays_3d
-    USE averaging
-    USE buoyancy_mod
-    USE control_parameters
-    USE cpulog
-#if defined( __dvrp_graphics )
-    USE DVRP
-#endif
-    USE grid_variables
-    USE indices
-    USE interaction_droplets_ptq_mod
-    USE ls_forcing_mod
-    USE particle_attributes
+    USE advec_ws,                                                              &
+        ONLY:  ws_statistics
+
+    USE arrays_3d,                                                             &
+        ONLY:  diss, e_p, nr_p, prho, pt, pt_p, ql, ql_c, ql_v, ql_vp, qr_p,   &
+               q_p, rho, sa_p, tend, u, u_p, v, vpt, v_p, w_p
+
+    USE buoyancy_mod,                                                          &
+        ONLY:  calc_mean_profile
+
+    USE control_parameters,                                                    &
+        ONLY:  advected_distance_x, advected_distance_y, average_count_3d,     &
+               average_count_sp, averaging_interval, averaging_interval_pr,    &
+               averaging_interval_sp, bc_lr_cyc, bc_ns_cyc,                    &
+               call_psolver_at_all_substeps, cloud_droplets, cloud_physics,    &
+               constant_heatflux, create_disturbances, dopr_n,                 &
+               constant_diffusion, coupling_mode, coupling_start_time,         &
+               current_timestep_number, disturbance_created,                   &
+               disturbance_energy_limit, dist_range, do_sum, dt_3d,            &
+               dt_averaging_input, dt_averaging_input_pr, dt_coupling,         &
+               dt_data_output_av, dt_disturb, dt_do2d_xy, dt_do2d_xz,          &
+               dt_do2d_yz, dt_do3d, dt_domask,dt_dopts, dt_dopr,               &
+               dt_dopr_listing, dt_dosp, dt_dots, dt_dvrp, dt_run_control,     &
+               end_time, first_call_lpm, galilei_transformation, humidity,     &
+               icloud_scheme, intermediate_timestep_count,                     &
+               intermediate_timestep_count_max, large_scale_forcing,           &
+               loop_optimization, lsf_surf, lsf_vert, masks, mid,              &
+               netcdf_data_format, neutral, nr_timesteps_this_run, ocean,      &
+               on_device, passive_scalar, prandtl_layer, precipitation,        &
+               prho_reference, pt_reference, pt_slope_offset, random_heatflux, &
+               run_coupled, simulated_time, simulated_time_chr,                &
+               skip_time_do2d_xy, skip_time_do2d_xz, skip_time_do2d_yz,        &
+               skip_time_do3d, skip_time_domask, skip_time_dopr,               &
+               skip_time_dosp, skip_time_data_output_av, sloping_surface,      &
+               stop_dt, terminate_coupled, terminate_run, timestep_scheme,     &
+               time_coupling, time_do2d_xy, time_do2d_xz, time_do2d_yz,        &
+               time_do3d, time_domask, time_dopr, time_dopr_av,                &
+               time_dopr_listing, time_dopts, time_dosp, time_dosp_av,         &
+               time_dots, time_do_av, time_do_sla, time_disturb, time_dvrp,    &
+               time_run_control, time_since_reference_point, turbulence,       &
+               turbulent_inflow, use_initial_profile_as_reference,             &
+               use_single_reference_value, u_gtrans, v_gtrans, ws_scheme_mom,  &
+               ws_scheme_sca
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  i_left, i_right, j_north, j_south, nbgp, nx, nxl, nxlg, nxr,    &
+               nxrg, nyn, nys, nzb, nzb_u_inner, nzb_v_inner 
+
+    USE interaction_droplets_ptq_mod,                                          &
+        ONLY:  interaction_droplets_ptq
+
+    USE kinds
+
+    USE ls_forcing_mod,                                                        &
+        ONLY:  ls_forcing_surf, ls_forcing_vert
+
+    USE particle_attributes,                                                   &
+        ONLY:  particle_advection, particle_advection_start, wang_kernel
+
     USE pegrid
-    USE production_e_mod
-    USE prognostic_equations_mod
-    USE statistics
-    USE user_actions_mod
+
+    USE production_e_mod,                                                      &
+        ONLY:  production_e_init
+
+    USE prognostic_equations_mod,                                              &
+        ONLY:  prognostic_equations_acc, prognostic_equations_cache,           &
+               prognostic_equations_vector
+
+    USE statistics,                                                            &
+        ONLY:  flow_statistics_called, hom, pr_palm
+
+    USE user_actions_mod,                                                      &
+        ONLY:  user_actions
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=9) ::  time_to_string
-    INTEGER           ::  netcdf_data_format_save
+    CHARACTER (LEN=9) ::  time_to_string          !: 
+
+    INTEGER(iwp)      ::  netcdf_data_format_save !: 
 
 !
Index: /palm/trunk/SOURCE/time_to_string.f90
===================================================================
--- /palm/trunk/SOURCE/time_to_string.f90	(revision 1319)
+++ /palm/trunk/SOURCE/time_to_string.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -28,9 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.3  2001/01/22 08:16:04  raasch
-! Comments translated into English
 !
 ! Revision 1.1  1997/08/11 06:26:08  raasch
@@ -43,9 +43,16 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+
     IMPLICIT NONE
 
-    CHARACTER (LEN=9) ::  time_to_string
-    INTEGER           ::  hours, minutes, seconds
-    REAL              ::  rest_time, time
+    CHARACTER (LEN=9) ::  time_to_string !: 
+
+    INTEGER(iwp)      ::  hours   !: 
+    INTEGER(iwp)      ::  minutes !: 
+    INTEGER(iwp)      ::  seconds !: 
+
+    REAL(wp)          ::  rest_time !: 
+    REAL(wp)          ::  time      !: 
 
 !
Index: /palm/trunk/SOURCE/timestep.f90
===================================================================
--- /palm/trunk/SOURCE/timestep.f90	(revision 1319)
+++ /palm/trunk/SOURCE/timestep.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -51,30 +57,4 @@
 ! special treatment in case of mirror velocity boundary condition removed
 !
-! 707 2011-03-29 11:39:40Z raasch
-! bc_lr/ns replaced by bc_lr/ns_cyc
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Exchange of terminate_coupled between ocean and atmosphere via PE0
-! Minimum grid spacing dxyz2_min(k) is now calculated using dzw instead of dzu
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 343 2009-06-24 12:59:09Z maronga
-! Additional timestep criterion in case of simulations with plant canopy
-! Output of messages replaced by message handling routine.
-!
-! 222 2009-01-12 16:04:16Z letzel
-! Implementation of a MPI-1 Coupling: replaced myid with target_id
-! Bugfix for nonparallel execution
-!
-! 108 2007-08-24 15:10:38Z letzel
-! modifications to terminate coupled runs
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.21  2006/02/23 12:59:44  raasch
-! nt_anz renamed current_timestep_number
-!
 ! Revision 1.1  1997/08/11 06:26:19  raasch
 ! Initial revision
@@ -86,26 +66,70 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE grid_variables
-    USE indices
+    USE arrays_3d,                                                             &
+        ONLY:  cdc, dzu, dzw, kh, km, lad_u, lad_v, lad_w, u, v, w
+
+    USE cloud_parameters,                                                      &
+        ONLY:  dt_precipitation
+
+    USE control_parameters,                                                    &
+        ONLY:  cfl_factor, coupling_mode, dt_3d, dt_fixed, dt_max,             &
+               galilei_transformation, old_dt, plant_canopy, message_string,   &
+               stop_dt, terminate_coupled, terminate_coupled_remote,           &
+               timestep_reason, u_gtrans, use_ug_for_galilei_tr, v_gtrans
+
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, log_point
+
+    USE grid_variables,                                                        &
+        ONLY:  dx, dx2, dy, dy2
+
+    USE indices,                                                               &
+        ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
+
     USE interfaces
+
+    USE kinds
+
     USE pegrid
-    USE statistics
+
+    USE statistics,                                                            &
+        ONLY:  flow_statistics_called, hom, u_max, u_max_ijk, v_max, v_max_ijk,&
+               w_max, w_max_ijk
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k
-
-    REAL ::  div, dt_diff, dt_diff_l, dt_plant_canopy, dt_plant_canopy_l,     &
-             dt_plant_canopy_u, dt_plant_canopy_v, dt_plant_canopy_w,         &
-             dt_u, dt_u_l, dt_v, dt_v_l, dt_w, dt_w_l, u_gtrans_l, u_max_l,   &
-             u_min_l, value, v_gtrans_l, v_max_l, v_min_l, w_max_l, w_min_l
-
-    REAL, DIMENSION(2)         ::  uv_gtrans, uv_gtrans_l
-    REAL, DIMENSION(3)         ::  reduce, reduce_l
-    REAL, DIMENSION(nzb+1:nzt) ::  dxyz2_min
+    INTEGER(iwp) ::  i !: 
+    INTEGER(iwp) ::  j !: 
+    INTEGER(iwp) ::  k !: 
+
+    REAL(wp) ::  div               !: 
+    REAL(wp) ::  dt_diff           !: 
+    REAL(wp) ::  dt_diff_l         !: 
+    REAL(wp) ::  dt_plant_canopy   !: 
+    REAL(wp) ::  dt_plant_canopy_l !: 
+    REAL(wp) ::  dt_plant_canopy_u !: 
+    REAL(wp) ::  dt_plant_canopy_v !: 
+    REAL(wp) ::  dt_plant_canopy_w !: 
+    REAL(wp) ::  dt_u              !: 
+    REAL(wp) ::  dt_u_l            !: 
+    REAL(wp) ::  dt_v              !: 
+    REAL(wp) ::  dt_v_l            !: 
+    REAL(wp) ::  dt_w              !: 
+    REAL(wp) ::  dt_w_l            !: 
+    REAL(wp) ::  u_gtrans_l        !: 
+    REAL(wp) ::  u_max_l           !: 
+    REAL(wp) ::  u_min_l           !: 
+    REAL(wp) ::  value             !: 
+    REAL(wp) ::  v_gtrans_l        !: 
+    REAL(wp) ::  v_max_l           !: 
+    REAL(wp) ::  v_min_l           !: 
+    REAL(wp) ::  w_max_l           !: 
+    REAL(wp) ::  w_min_l           !: 
+ 
+    REAL(wp), DIMENSION(2)         ::  uv_gtrans   !: 
+    REAL(wp), DIMENSION(2)         ::  uv_gtrans_l !: 
+    REAL(wp), DIMENSION(3)         ::  reduce      !: 
+    REAL(wp), DIMENSION(3)         ::  reduce_l    !: 
+    REAL(wp), DIMENSION(nzb+1:nzt) ::  dxyz2_min   !:  
 
 
@@ -222,9 +246,9 @@
     ENDIF
 #else
-    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, u, 'abs', 0.0, &
+    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, u, 'abs', 0.0_wp, &
                          u_max, u_max_ijk )
-    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, v, 'abs', 0.0, &
+    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, v, 'abs', 0.0_wp, &
                          v_max, v_max_ijk )
-    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, w, 'abs', 0.0, &
+    CALL global_min_max( nzb, nzt+1, nysg, nyng, nxlg, nxrg, w, 'abs', 0.0_wp, &
                          w_max, w_max_ijk )
 #endif
Index: /palm/trunk/SOURCE/timestep_scheme_steering.f90
===================================================================
--- /palm/trunk/SOURCE/timestep_scheme_steering.f90	(revision 1319)
+++ /palm/trunk/SOURCE/timestep_scheme_steering.f90	(revision 1320)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
 !
 ! Former revisions:
@@ -32,12 +32,4 @@
 ! all actions concerning leapfrog scheme removed
 !
-! 673 2011-01-18 16:19:48Z suehring
-! No pressure term during time integration (tsc(4)=0.0).
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.2  2005/03/26 21:17:06  raasch
-! No pressure term for Runge-Kutta-schemes (tsc(4)=0.0)
-!
 ! Revision 1.1  2004/01/28 15:34:47  raasch
 ! Initial revision
@@ -50,5 +42,6 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
+    USE control_parameters,                                                    &
+        ONLY:  intermediate_timestep_count, timestep_scheme, tsc
 
     IMPLICIT NONE
Index: /palm/trunk/SOURCE/transpose.f90
===================================================================
--- /palm/trunk/SOURCE/transpose.f90	(revision 1319)
+++ /palm/trunk/SOURCE/transpose.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -55,27 +61,4 @@
 ! indices nxa, nya, etc. replaced by nx, ny, etc.
 !
-! 683 2011-02-09 14:25:15Z raasch
-! openMP parallelization of transpositions for 2d-domain-decomposition
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 164 2008-05-15 08:46:15Z raasch
-! f_inv changed from subroutine argument to automatic array in order to do
-! re-ordering from f_in to f_inv in one step, one array work is needed instead
-! of work1 and work2
-!
-! February 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.2  2004/04/30 13:12:17  raasch
-! Switched from mpi_alltoallv to the simpler mpi_alltoall,
-! all former transpose-routine files collected in this file, enlarged
-! transposition arrays introduced
-!
-! Revision 1.1  2004/04/30 13:08:16  raasch
-! Initial revision (collection of former routines transpose_xy, transpose_xz,
-!                   transpose_yx, transpose_yz, transpose_zx, transpose_zy)
-!
 ! Revision 1.1  1997/07/24 11:25:18  raasch
 ! Initial revision
@@ -88,15 +71,21 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  nx
+
+     USE kinds
+
+     USE transpose_indices,                                                    &
+         ONLY:  nxl_z, nxr_z, nyn_x, nyn_z, nys_x, nys_z, nzb_x, nzt_x
 
      IMPLICIT NONE
 
-     REAL ::  f_in(0:nx,nys_x:nyn_x,nzb_x:nzt_x)
-     REAL ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx)
-
-
-     INTEGER ::  i, j, k
-
+     REAL(wp) ::  f_in(0:nx,nys_x:nyn_x,nzb_x:nzt_x)  !: 
+     REAL(wp) ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx) !: 
+
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 !
 !-- Rearrange indices of input array in order to make data to be send
@@ -128,16 +117,29 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nx, ny
+        
+    USE kinds
+
     USE pegrid
-    USE transpose_indices
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxr_y, nyn_x, nys_x, nzb_x, nzb_y, nzt_x, nzt_y
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, ys
-    
-    REAL ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx), f_out(0:ny,nxl_y:nxr_y,nzb_y:nzt_y)
-
-    REAL, DIMENSION(nyn_x-nys_x+1,nzb_y:nzt_y,nxl_y:nxr_y,0:pdims(2)-1) ::  work
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  ys !: 
+ 
+    REAL(wp) ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx) !: 
+    REAL(wp) ::  f_out(0:ny,nxl_y:nxr_y,nzb_y:nzt_y) !: 
+
+    REAL(wp), DIMENSION(nyn_x-nys_x+1,nzb_y:nzt_y,nxl_y:nxr_y,0:pdims(2)-1) ::  work !: 
 
 
@@ -207,15 +209,17 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  nxl, nxr, nyn, nys, nz
+
+     USE kinds
 
      IMPLICIT NONE
 
-     REAL ::  f_inv(nys:nyn,nxl:nxr,1:nz)
-     REAL ::  f_out(1:nz,nys:nyn,nxl:nxr)
-
-
-     INTEGER ::  i, j, k
-
+     REAL(wp) ::  f_inv(nys:nyn,nxl:nxr,1:nz) !: 
+     REAL(wp) ::  f_out(1:nz,nys:nyn,nxl:nxr) !: 
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 !
 !-- Rearrange indices of input array in order to make data to be send
@@ -249,16 +253,31 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nnx, nx, nxl, nxr, ny, nyn, nys, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dx, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_zx
+
+    USE transpose_indices,                                                     &
+        ONLY:  nyn_x, nys_x, nzb_x, nzt_x
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, xs
-    
-    REAL ::  f_in(0:nx,nys_x:nyn_x,nzb_x:nzt_x), f_inv(nys:nyn,nxl:nxr,1:nz)
-
-    REAL, DIMENSION(nys_x:nyn_x,nnx,nzb_x:nzt_x,0:pdims(1)-1) ::  work
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  xs !: 
+
+    REAL(wp) ::  f_in(0:nx,nys_x:nyn_x,nzb_x:nzt_x) !: 
+    REAL(wp) ::  f_inv(nys:nyn,nxl:nxr,1:nz) !: 
+
+    REAL(wp), DIMENSION(nys_x:nyn_x,nnx,nzb_x:nzt_x,0:pdims(1)-1) ::  work !: 
 
 
@@ -331,15 +350,21 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  nx
+
+     USE kinds
+
+     USE transpose_indices,                                                    &
+         ONLY:  nyn_x, nys_x, nzb_x, nzt_x
 
      IMPLICIT NONE
 
-     REAL ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx)
-     REAL ::  f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x)
-
-
-     INTEGER ::  i, j, k
-
+     REAL(wp) ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx) !: 
+     REAL(wp) ::  f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x) !: 
+
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 !
 !-- Rearrange indices of input array in order to make data to be send
@@ -371,16 +396,31 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nx, ny
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dy, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               numprocs, pdims, sendrecvcount_xy
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxr_y, nyn_x, nys_x, nzb_x, nzb_y, nzt_x, nzt_y
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, ys
-    
-    REAL ::  f_in(0:ny,nxl_y:nxr_y,nzb_y:nzt_y), f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx)
-
-    REAL, DIMENSION(nyn_x-nys_x+1,nzb_y:nzt_y,nxl_y:nxr_y,0:pdims(2)-1) ::  work
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  ys !: 
+
+    REAL(wp) ::  f_in(0:ny,nxl_y:nxr_y,nzb_y:nzt_y)  !: 
+    REAL(wp) ::  f_inv(nys_x:nyn_x,nzb_x:nzt_x,0:nx) !: 
+
+    REAL(wp), DIMENSION(nyn_x-nys_x+1,nzb_y:nzt_y,nxl_y:nxr_y,0:pdims(2)-1) ::  work !: 
 
 
@@ -453,17 +493,32 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nnx, nny, nnz, nx, nxl, nxr, nyn, nys, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dx, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_xy
+
+    USE transpose_indices,                                                     &
+        ONLY:  nyn_x, nys_x, nzb_x, nzt_x
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, m, xs
-
-    REAL ::  f_in(1:nz,nys:nyn,nxl:nxr), f_inv(nxl:nxr,1:nz,nys:nyn), &
-             f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x),                     &
-             work(nnx*nny*nnz)
-
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  m  !: 
+    INTEGER(iwp) ::  xs !: 
+
+    REAL(wp) ::  f_in(1:nz,nys:nyn,nxl:nxr)          !: 
+    REAL(wp) ::  f_inv(nxl:nxr,1:nz,nys:nyn)         !: 
+    REAL(wp) ::  f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x) !: 
+    REAL(wp) ::  work(nnx*nny*nnz)                   !: 
 #if defined( __parallel )
 
@@ -517,14 +572,20 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  ny
+
+     USE kinds
+
+     USE transpose_indices,                                                    &
+         ONLY:  nxl_y, nxr_y, nzb_y, nzt_y
 
      IMPLICIT NONE
 
-     REAL ::  f_in(0:ny,nxl_y:nxr_y,nzb_y:nzt_y)
-     REAL ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny)
-
-
-     INTEGER ::  i, j, k
+     REAL(wp) ::  f_in(0:ny,nxl_y:nxr_y,nzb_y:nzt_y)  !: 
+     REAL(wp) ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny) !: 
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 
 !
@@ -557,16 +618,31 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  ny, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dx, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_yz
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxl_z, nxr_y, nxr_z, nyn_z, nys_z, nzb_y, nzt_y
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, zs
-    
-    REAL ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny), f_out(nxl_z:nxr_z,nys_z:nyn_z,1:nz)
-
-    REAL, DIMENSION(nxl_z:nxr_z,nzt_y-nzb_y+1,nys_z:nyn_z,0:pdims(1)-1) ::  work
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  zs !: 
+
+    REAL(wp) ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny) !: 
+    REAL(wp) ::  f_out(nxl_z:nxr_z,nys_z:nyn_z,1:nz) !: 
+
+    REAL(wp), DIMENSION(nxl_z:nxr_z,nzt_y-nzb_y+1,nys_z:nyn_z,0:pdims(1)-1) ::  work !: 
 
 
@@ -637,14 +713,17 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  nxl, nxr, nyn, nys, nz
+
+     USE kinds
 
      IMPLICIT NONE
 
-     REAL ::  f_in(1:nz,nys:nyn,nxl:nxr)
-     REAL ::  f_inv(nys:nyn,nxl:nxr,1:nz)
-
-
-     INTEGER ::  i, j, k
+     REAL(wp) ::  f_in(1:nz,nys:nyn,nxl:nxr)  !: 
+     REAL(wp) ::  f_inv(nys:nyn,nxl:nxr,1:nz) !: 
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 
 !
@@ -677,16 +756,31 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nnx, nx, nxl, nxr, nyn, nys, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dx, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_zx
+
+    USE transpose_indices,                                                     &
+        ONLY:  nyn_x, nys_x, nzb_x, nzt_x
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, xs
-    
-    REAL ::  f_inv(nys:nyn,nxl:nxr,1:nz), f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x)
-
-    REAL, DIMENSION(nys_x:nyn_x,nnx,nzb_x:nzt_x,0:pdims(1)-1) ::  work
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  xs !: 
+
+    REAL(wp) ::  f_inv(nys:nyn,nxl:nxr,1:nz)         !: 
+    REAL(wp) ::  f_out(0:nx,nys_x:nyn_x,nzb_x:nzt_x) !: 
+
+    REAL(wp), DIMENSION(nys_x:nyn_x,nnx,nzb_x:nzt_x,0:pdims(1)-1) ::  work !: 
 
 
@@ -757,14 +851,21 @@
 !------------------------------------------------------------------------------!
 
-     USE indices
-     USE transpose_indices
+     USE indices,                                                              &
+         ONLY:  ny
+
+     USE kinds
+
+     USE transpose_indices,                                                    &
+         ONLY:  nxl_y, nxr_y, nzb_y, nzt_y
 
      IMPLICIT NONE
 
-     REAL ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny)
-     REAL ::  f_out(0:ny,nxl_y:nxr_y,nzb_y:nzt_y)
-
-
-     INTEGER ::  i, j, k
+     REAL(wp) ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny) !: 
+     REAL(wp) ::  f_out(0:ny,nxl_y:nxr_y,nzb_y:nzt_y) !: 
+
+
+     INTEGER(iwp) ::  i !: 
+     INTEGER(iwp) ::  j !: 
+     INTEGER(iwp) ::  k !: 
 
 !
@@ -797,17 +898,31 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  ny, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dx, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_yz
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxl_z, nxr_y, nxr_z, nyn_z, nys_z, nzb_y, nzt_y
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, zs
-    
-    REAL ::  f_in(nxl_z:nxr_z,nys_z:nyn_z,1:nz), f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny)
-
-    REAL, DIMENSION(nxl_z:nxr_z,nzt_y-nzb_y+1,nys_z:nyn_z,0:pdims(1)-1) ::  work
-
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  zs !: 
+
+    REAL(wp) ::  f_in(nxl_z:nxr_z,nys_z:nyn_z,1:nz)  !: 
+    REAL(wp) ::  f_inv(nxl_y:nxr_y,nzb_y:nzt_y,0:ny) !: 
+
+    REAL(wp), DIMENSION(nxl_z:nxr_z,nzt_y-nzb_y+1,nys_z:nyn_z,0:pdims(1)-1) ::  work !:
 
 !
@@ -881,16 +996,32 @@
 !------------------------------------------------------------------------------!
 
-    USE cpulog
-    USE indices
-    USE pegrid
-    USE transpose_indices
+    USE cpulog,                                                                &
+        ONLY:  cpu_log, cpu_log_nowait, log_point_s
+
+    USE indices,                                                               &
+        ONLY:  nnx, nny, nnz, nxl, nxr, nyn, nys, ny, nz
+
+    USE kinds
+
+    USE pegrid,                                                                &
+        ONLY:  collective_wait, comm1dy, comm2d, ierr, MPI_DOUBLE_PRECISION,   &
+               pdims, sendrecvcount_zyd
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_y, nxl_yd, nxr_y, nxr_yd, nzb_y, nzb_yd, nzt_y, nzt_yd
 
     IMPLICIT NONE
 
-    INTEGER ::  i, j, k, l, m, ys
-    
-    REAL ::  f_in(1:nz,nys:nyn,nxl:nxr), f_inv(nys:nyn,nxl:nxr,1:nz), &
-             f_out(0:ny,nxl_yd:nxr_yd,nzb_yd:nzt_yd),                 &
-             work(nnx*nny*nnz)
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
+    INTEGER(iwp) ::  l  !: 
+    INTEGER(iwp) ::  m  !: 
+    INTEGER(iwp) ::  ys !: 
+
+    REAL(wp) ::  f_in(1:nz,nys:nyn,nxl:nxr)              !: 
+    REAL(wp) ::  f_inv(nys:nyn,nxl:nxr,1:nz)             !: 
+    REAL(wp) ::  f_out(0:ny,nxl_yd:nxr_yd,nzb_yd:nzt_yd) !: 
+    REAL(wp) ::  work(nnx*nny*nnz)                       !: 
 
 #if defined( __parallel )
Index: /palm/trunk/SOURCE/tridia_solver.f90
===================================================================
--- /palm/trunk/SOURCE/tridia_solver.f90	(revision 1319)
+++ /palm/trunk/SOURCE/tridia_solver.f90	(revision 1320)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! ------------------
-!
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -55,10 +61,15 @@
 !------------------------------------------------------------------------------!
 
-    USE indices
-    USE transpose_indices
+    USE indices,                                                               &
+        ONLY:  nx, ny, nz
+
+    USE kinds
+
+    USE transpose_indices,                                                     &
+        ONLY:  nxl_z, nyn_z, nxr_z, nys_z
 
     IMPLICIT NONE
 
-    REAL, DIMENSION(:,:), ALLOCATABLE ::  ddzuw
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ddzuw !: 
 
     PRIVATE
@@ -79,9 +90,12 @@
     SUBROUTINE tridia_init
 
-       USE arrays_3d,  ONLY:  ddzu_pres, ddzw
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu_pres, ddzw
+
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  k
+       INTEGER(iwp) ::  k !: 
 
        ALLOCATE( ddzuw(0:nz-1,3) )
@@ -109,14 +123,28 @@
 !------------------------------------------------------------------------------!
 
-          USE arrays_3d,  ONLY: tric
-          USE constants
-          USE control_parameters
-          USE grid_variables
+          USE arrays_3d,                                                       &
+              ONLY:  tric
+
+          USE constants,                                                       &
+              ONLY:  pi
+
+          USE control_parameters,                                              &
+              ONLY:  ibc_p_b, ibc_p_t
+
+          USE grid_variables,                                                  &
+              ONLY:  dx, dy
+
+
+          USE kinds
 
           IMPLICIT NONE
 
-          INTEGER ::  i, j, k, nnxh, nnyh
-
-          REAL    ::  ll(nxl_z:nxr_z,nys_z:nyn_z)
+          INTEGER(iwp) ::  i    !: 
+          INTEGER(iwp) ::  j    !: 
+          INTEGER(iwp) ::  k    !: 
+          INTEGER(iwp) ::  nnxh !: 
+          INTEGER(iwp) ::  nnyh !: 
+
+          REAL(wp)    ::  ll(nxl_z:nxr_z,nys_z:nyn_z) !: 
           !$acc declare create( ll )
 
@@ -201,14 +229,21 @@
 !------------------------------------------------------------------------------!
 
-          USE arrays_3d,  ONLY: tri
-          USE control_parameters
+          USE arrays_3d,                                                       & 
+              ONLY:  tri
+
+          USE control_parameters,                                              &
+              ONLY:  ibc_p_b, ibc_p_t
+
+          USE kinds
 
           IMPLICIT NONE
 
-          INTEGER ::  i, j, k
-
-          REAL    ::  ar(nxl_z:nxr_z,nys_z:nyn_z,1:nz)
-
-          REAL, DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1)   ::  ar1
+          INTEGER(iwp) ::  i !: 
+          INTEGER(iwp) ::  j !: 
+          INTEGER(iwp) ::  k !: 
+
+          REAL(wp)     ::  ar(nxl_z:nxr_z,nys_z:nyn_z,1:nz) !: 
+
+          REAL(wp), DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1)   ::  ar1 !: 
           !$acc declare create( ar1 )
 
@@ -275,15 +310,23 @@
 !------------------------------------------------------------------------------!
 
-          USE arrays_3d,  ONLY: tri
-          USE control_parameters
+          USE arrays_3d,                                                       &
+              ONLY:  tri
+
+          USE control_parameters,                                              &
+              ONLY:  ibc_p_b, ibc_p_t
+
+          USE kinds
 
           IMPLICIT NONE
 
-          INTEGER ::  i, j, jj, k
-
-          REAL    ::  ar(nxl_z:nxr_z,nys_z:nyn_z,1:nz)
+          INTEGER(iwp) ::  i  !: 
+          INTEGER(iwp) ::  j  !: 
+          INTEGER(iwp) ::  jj !: 
+          INTEGER(iwp) ::  k  !: 
+
+          REAL(wp)     ::  ar(nxl_z:nxr_z,nys_z:nyn_z,1:nz) !: 
 
           !$acc declare create( ar1 )
-          REAL, DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1)   ::  ar1
+          REAL(wp), DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1) ::  ar1 !: 
 
 !
@@ -350,10 +393,14 @@
 !------------------------------------------------------------------------------!
 
-          USE arrays_3d,  ONLY: tri, tric
+          USE arrays_3d,                                                       & 
+              ONLY:  tri, tric
+
+          USE kinds
 
           IMPLICIT NONE
 
-          INTEGER ::  i, j, k
-
+          INTEGER(iwp) ::  i !: 
+          INTEGER(iwp) ::  j !: 
+          INTEGER(iwp) ::  k !: 
 !
 !--       Splitting
@@ -398,17 +445,28 @@
 !------------------------------------------------------------------------------!
 
-       USE arrays_3d
-       USE control_parameters
-
-       USE pegrid
+       USE arrays_3d,                                                          &
+           ONLY:  ddzu_pres, ddzw
+
+       USE control_parameters,                                                 &
+           ONLY:  ibc_p_b, ibc_p_t
+
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, nnyh, nx, ny, omp_get_thread_num, tn
-
-       REAL    ::  ddx2, ddy2
-
-       REAL, DIMENSION(0:nx,1:nz)     ::  ar
-       REAL, DIMENSION(5,0:nx,0:nz-1) ::  tri_for_1d
+       INTEGER(iwp) ::  i                  !: 
+       INTEGER(iwp) ::  j                  !: 
+       INTEGER(iwp) ::  k                  !: 
+       INTEGER(iwp) ::  nnyh               !: 
+       INTEGER(iwp) ::  nx                 !: 
+       INTEGER(iwp) ::  ny                 !: 
+       INTEGER(iwp) ::  omp_get_thread_num !: 
+       INTEGER(iwp) ::  tn                 !: 
+
+       REAL(wp)     ::  ddx2 !: 
+       REAL(wp)     ::  ddy2 !: 
+
+       REAL(wp), DIMENSION(0:nx,1:nz)     ::  ar         !: 
+       REAL(wp), DIMENSION(5,0:nx,0:nz-1) ::  tri_for_1d !: 
 
 
@@ -465,15 +523,23 @@
 !------------------------------------------------------------------------------!
 
-          USE constants
+          USE constants,                                                       &
+              ONLY:  pi
+
+          USE kinds
 
           IMPLICIT NONE
 
-          INTEGER ::  i, j, k, nnxh
-          REAL    ::  a, c
-
-          REAL, DIMENSION(0:nx) ::  l
+          INTEGER(iwp) ::  i    !: 
+          INTEGER(iwp) ::  j    !: 
+          INTEGER(iwp) ::  k    !: 
+          INTEGER(iwp) ::  nnxh !: 
+
+          REAL(wp)     ::  a !: 
+          REAL(wp)     ::  c !: 
+
+          REAL(wp), DIMENSION(0:nx) ::  l !: 
 
 #if defined( __intel11 )
-          REAL, DIMENSION(5,0:nx,0:nz-1) ::  tri_for_1d
+          REAL(wp), DIMENSION(5,0:nx,0:nz-1) ::  tri_for_1d !: 
 #endif
 
@@ -533,8 +599,9 @@
           IMPLICIT NONE
 
-          INTEGER ::  i, k
+          INTEGER(iwp) ::  i !: 
+          INTEGER(iwp) ::  k !: 
 
 #if defined( __intel11 )
-          REAL, DIMENSION(5,0:nx,0:nz-1) ::  tri_for_1d
+          REAL(wp), DIMENSION(5,0:nx,0:nz-1) ::  tri_for_1d !: 
 #endif
 
@@ -563,9 +630,10 @@
           IMPLICIT NONE
 
-          INTEGER ::  i, k
-
-          REAL, DIMENSION(0:nx,nz)       ::  ar
-          REAL, DIMENSION(0:nx,0:nz-1)   ::  ar1
-          REAL, DIMENSION(5,0:nx,0:nz-1) ::  tri_for_1d
+          INTEGER(iwp) ::  i !: 
+          INTEGER(iwp) ::  k !: 
+
+          REAL(wp), DIMENSION(0:nx,nz)       ::  ar         !: 
+          REAL(wp), DIMENSION(0:nx,0:nz-1)   ::  ar1        !: 
+          REAL(wp), DIMENSION(5,0:nx,0:nz-1) ::  tri_for_1d !: 
 
 !
Index: /palm/trunk/SOURCE/user_3d_data_averaging.f90
===================================================================
--- /palm/trunk/SOURCE/user_3d_data_averaging.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_3d_data_averaging.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! -----------------
-! 
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -39,13 +43,19 @@
 
     USE control_parameters
+
     USE indices
+
+    USE kinds
+
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  mode, variable
+    CHARACTER (LEN=*) ::  mode    !: 
+    CHARACTER (LEN=*) :: variable !: 
 
-    INTEGER ::  i, j, k
-
+    INTEGER(iwp) ::  i !: 
+    INTEGER(iwp) ::  j !: 
+    INTEGER(iwp) ::  k !: 
 
     IF ( mode == 'allocate' )  THEN
Index: /palm/trunk/SOURCE/user_actions.f90
===================================================================
--- /palm/trunk/SOURCE/user_actions.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_actions.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-!
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -34,10 +38,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 258 2009-03-13 12:36:03Z heinze
-! Output of messages replaced by message handling routine.
 !
 ! 211 2008-11-11 04:46:24Z raasch
@@ -66,15 +64,24 @@
 
        USE control_parameters
+
        USE cpulog
+
        USE indices
+
+       USE kinds
+
        USE pegrid
+
        USE user
+
        USE arrays_3d
 
        IMPLICIT NONE
 
-       CHARACTER (LEN=*) ::  location
-
-       INTEGER ::  i, j, k
+       CHARACTER (LEN=*) ::  location !: 
+
+       INTEGER(iwp) ::  i !: 
+       INTEGER(iwp) ::  j !: 
+       INTEGER(iwp) ::  k !: 
 
        CALL cpu_log( log_point(24), 'user_actions', 'start' )
@@ -165,4 +172,5 @@
 
        USE control_parameters
+       USE kinds
        USE pegrid
        USE user
@@ -172,6 +180,7 @@
        CHARACTER (LEN=*) ::  location
 
-       INTEGER ::  i, idum, j
-
+       INTEGER(iwp) ::  i
+       INTEGER(iwp) ::  idum
+       INTEGER(iwp) ::  j
 
 !
Index: /palm/trunk/SOURCE/user_additional_routines.f90
===================================================================
--- /palm/trunk/SOURCE/user_additional_routines.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_additional_routines.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! -----------------
-! 
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -37,4 +41,6 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+
     USE user
 
Index: /palm/trunk/SOURCE/user_check_data_output.f90
===================================================================
--- /palm/trunk/SOURCE/user_check_data_output.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_check_data_output.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! -----------------
-! 
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -40,9 +44,12 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  unit, variable
+    CHARACTER (LEN=*) ::  unit     !: 
+    CHARACTER (LEN=*) ::  variable !:
 
 
Index: /palm/trunk/SOURCE/user_check_data_output_pr.f90
===================================================================
--- /palm/trunk/SOURCE/user_check_data_output_pr.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_check_data_output_pr.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! -----------------
-! 
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -41,16 +45,24 @@
 
     USE arrays_3d
+
     USE indices
+
+    USE kinds
+
     USE netcdf_control
+
     USE profil_parameter
+
     USE statistics
+
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  unit, variable
+    CHARACTER (LEN=*) ::  unit     !: 
+    CHARACTER (LEN=*) ::  variable !: 
 
-    INTEGER ::  index, var_count
-
+    INTEGER(iwp) ::  user_pr_index !: 
+    INTEGER(iwp) ::  var_count     !: 
 
     SELECT CASE ( TRIM( variable ) )
@@ -62,13 +74,13 @@
 !--    to be performed have to be added in routine user_statistics.
 !--    The quantities are (internally) identified by a user-profile-number
-!--    (see variable "index" below). The first user-profile must be assigned
+!--    (see variable "user_pr_index" below). The first user-profile must be assigned
 !--    the number "pr_palm+1", the second one "pr_palm+2", etc. The respective
 !--    user-profile-numbers have also to be used in routine user_statistics!
 !       CASE ( 'u*v*' )                      ! quantity string as given in
 !                                            ! data_output_pr_user
-!          index = pr_palm + 1
-!          dopr_index(var_count)  = index    ! quantities' user-profile-number
+!          user_pr_index = pr_palm + 1
+!          dopr_index(var_count)  = user_pr_index    ! quantities' user-profile-number
 !          dopr_unit(var_count)   = 'm2/s2'  ! quantity unit
-!          hom(:,2,index,:)       = SPREAD( zu, 2, statistic_regions+1 )
+!          hom(:,2,user_pr_index,:)       = SPREAD( zu, 2, statistic_regions+1 )
 !                                            ! grid on which the quantity is
 !                                            ! defined (use zu or zw)
Index: /palm/trunk/SOURCE/user_check_parameters.f90
===================================================================
--- /palm/trunk/SOURCE/user_check_parameters.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_check_parameters.f90	(revision 1320)
@@ -20,4 +20,9 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -37,4 +42,7 @@
 
     USE control_parameters
+
+    USE kinds
+
     USE user
 
Index: /palm/trunk/SOURCE/user_data_output_2d.f90
===================================================================
--- /palm/trunk/SOURCE/user_data_output_2d.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_data_output_2d.f90	(revision 1320)
@@ -20,4 +20,9 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -27,10 +32,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 343 2009-06-24 12:59:09Z maronga
-! +dummy argument two_d
 !
 ! 211 2008-11-11 04:46:24Z raasch
@@ -45,15 +44,23 @@
 
     USE indices
+
+    USE kinds
+
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  grid, variable
+    CHARACTER (LEN=*) ::  grid     !: 
+    CHARACTER (LEN=*) ::  variable !: 
 
-    INTEGER ::  av, i, j, k
+    INTEGER(iwp) ::  av !: 
+    INTEGER(iwp) ::  i  !: 
+    INTEGER(iwp) ::  j  !: 
+    INTEGER(iwp) ::  k  !: 
 
-    LOGICAL ::  found, two_d
+    LOGICAL      ::  found !: 
+    LOGICAL      ::  two_d !: 
 
-    REAL, DIMENSION(nxlg:nxrg,nysg:nyng,nzb:nzt+1) ::  local_pf
+    REAL(wp), DIMENSION(nxlg:nxrg,nysg:nyng,nzb:nzt+1) ::  local_pf !: 
 
 
Index: /palm/trunk/SOURCE/user_data_output_3d.f90
===================================================================
--- /palm/trunk/SOURCE/user_data_output_3d.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_data_output_3d.f90	(revision 1320)
@@ -20,5 +20,9 @@
 ! Current revisions:
 ! ------------------
-! 
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -32,7 +36,4 @@
 ! code put under GPL (PALM 3.9)
 !
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
 ! 211 2008-11-11 04:46:24Z raasch
 ! Former file user_interface.f90 split into one file per subroutine
@@ -45,16 +46,22 @@
 
     USE indices
-    USE precision_kind
+
+    USE kinds
+
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  variable
+    CHARACTER (LEN=*) ::  variable !: 
 
-    INTEGER ::  av, i, j, k, nz_do
+    INTEGER(iwp) ::  av    !: 
+    INTEGER(iwp) ::  i     !: 
+    INTEGER(iwp) ::  j     !: 
+    INTEGER(iwp) ::  k     !: 
+    INTEGER(iwp) ::  nz_do !: 
 
-    LOGICAL ::  found
+    LOGICAL      ::  found !: 
 
-   REAL(spk), DIMENSION(nxlg:nxrg,nysg:nyng,nzb:nz_do) ::  local_pf
+   REAL(sp), DIMENSION(nxlg:nxrg,nysg:nyng,nzb:nz_do) ::  local_pf !: 
 
 
Index: /palm/trunk/SOURCE/user_data_output_dvrp.f90
===================================================================
--- /palm/trunk/SOURCE/user_data_output_dvrp.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_data_output_dvrp.f90	(revision 1320)
@@ -20,5 +20,10 @@
 ! Current revisions:
 ! -----------------
-! 
+! kind-parameters added to all INTEGER and REAL declaration statements,
+! kinds are defined in new module kinds,
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 ! Former revisions:
@@ -28,8 +33,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 258 2009-03-13 12:36:03Z heinze
-! Output of messages replaced by message handling routine.
-! Clipping implemented
 !
 ! 211 2008-11-11 04:46:24Z raasch
@@ -42,17 +43,25 @@
 
     USE control_parameters
+
     USE dvrp_variables
+
     USE indices
+
+    USE kinds
+
     USE pegrid
+
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  output_variable
+    CHARACTER (LEN=*) ::  output_variable !: 
 
-    INTEGER ::  i, j, k
+    INTEGER(iwp) ::  i !: 
+    INTEGER(iwp) ::  j !: 
+    INTEGER(iwp) ::  k !: 
 
-    REAL, DIMENSION(nxl_dvrp:nxr_dvrp+1,nys_dvrp:nyn_dvrp+1,nzb:nz_do3d) ::  &
-                                                                       local_pf
+    REAL(wp), DIMENSION(nxl_dvrp:nxr_dvrp+1,nys_dvrp:nyn_dvrp+1,nzb:nz_do3d) :: &
+              local_pf !: 
 
 !
Index: /palm/trunk/SOURCE/user_data_output_mask.f90
===================================================================
--- /palm/trunk/SOURCE/user_data_output_mask.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_data_output_mask.f90	(revision 1320)
@@ -20,4 +20,9 @@
 ! Current revisions:
 ! ------------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 ! 
 !
@@ -29,6 +34,4 @@
 ! code put under GPL (PALM 3.9)
 !
-! Initial version
-!
 ! Description:
 ! ------------
@@ -38,17 +41,25 @@
 
     USE control_parameters
+        
     USE indices
+    
+    USE kinds
+    
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  variable
+    CHARACTER (LEN=*) ::  variable   !: 
 
-    INTEGER ::  av, i, j, k
+    INTEGER(iwp) ::  av   !: 
+    INTEGER(iwp) ::  i    !: 
+    INTEGER(iwp) ::  j    !: 
+    INTEGER(iwp) ::  k    !: 
 
-    LOGICAL ::  found
+    LOGICAL ::  found     !: 
 
-    REAL, DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2), &
-                    mask_size_l(mid,3)) ::  local_pf
+    REAL(wp),                                                                  &
+       DIMENSION(mask_size_l(mid,1),mask_size_l(mid,2),mask_size_l(mid,3)) ::  &
+          local_pf   !: 
 
 
@@ -57,5 +68,4 @@
     SELECT CASE ( TRIM( variable ) )
 
-!
 !--    Uncomment and extend the following lines, if necessary.
 !--    The arrays for storing the user defined quantities (here u2 and u2_av)
@@ -67,5 +77,5 @@
 !               DO  j = 1, mask_size_l(mid,2)
 !                  DO  k = 1, mask_size_l(mid,3)
-!                      local_pf(i,j,k) = u2(mask_k(mid,k), &
+!                      local_pf(i,j,k) = u2(mask_k(mid,k),                       &
 !                                           mask_j(mid,j),mask_i(mid,i))
 !                   ENDDO
@@ -76,5 +86,5 @@
 !               DO  j = 1, mask_size_l(mid,2)
 !                  DO  k = 1, mask_size_l(mid,3)
-!                      local_pf(i,j,k) = u2_av(mask_k(mid,k), &
+!                      local_pf(i,j,k) = u2_av(mask_k(mid,k),                    &
 !                                              mask_j(mid,j),mask_i(mid,i))
 !                   ENDDO
@@ -82,5 +92,4 @@
 !             ENDDO
 !          ENDIF
-!
 
        CASE DEFAULT
Index: /palm/trunk/SOURCE/user_define_netcdf_grid.f90
===================================================================
--- /palm/trunk/SOURCE/user_define_netcdf_grid.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_define_netcdf_grid.f90	(revision 1320)
@@ -20,4 +20,6 @@
 ! Current revisions:
 ! -----------------
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 ! 
 !
@@ -39,11 +41,16 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+    
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  grid_x, grid_y, grid_z, variable
+    CHARACTER (LEN=*) ::  grid_x     !: 
+    CHARACTER (LEN=*) ::  grid_y     !: 
+    CHARACTER (LEN=*) ::  grid_z     !: 
+    CHARACTER (LEN=*) ::  variable   !: 
 
-    LOGICAL ::  found
+    LOGICAL ::  found   !: 
 
 
Index: /palm/trunk/SOURCE/user_dvrp_coltab.f90
===================================================================
--- /palm/trunk/SOURCE/user_dvrp_coltab.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_dvrp_coltab.f90	(revision 1320)
@@ -20,4 +20,7 @@
 ! Current revisions:
 ! -----------------
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 ! 
 !
@@ -28,7 +31,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 258 2009-03-13 12:36:03Z heinze
-! Output of messages replaced by message handling routine.
 !
 ! 211 2008-11-11 04:46:24Z raasch
@@ -41,12 +41,17 @@
     
     USE control_parameters
+        
     USE dvrp_variables
+    
+    USE kinds
+    
     USE pegrid
+    
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  mode
-    CHARACTER (LEN=*) ::  variable
+    CHARACTER (LEN=*) ::  mode       !: 
+    CHARACTER (LEN=*) ::  variable   !: 
 
 
Index: /palm/trunk/SOURCE/user_header.f90
===================================================================
--- /palm/trunk/SOURCE/user_header.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_header.f90	(revision 1320)
@@ -20,4 +20,11 @@
 ! Current revisions:
 ! -----------------
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 ! 
 !
@@ -28,8 +35,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 256 2009-03-08 08:56:27Z letzel
-! new topography case 'single_street_canyon'
-! topography_grid_convention moved to header
 !
 ! 2008-12-09 18:00:48Z letzel
@@ -42,11 +45,15 @@
 !------------------------------------------------------------------------------!
 
-    USE control_parameters
-    USE statistics
+    USE kinds
+    
+    USE statistics,                                                            &
+        ONLY:  statistic_regions, region
+        
     USE user
 
     IMPLICIT NONE
 
-    INTEGER ::  i, io
+    INTEGER(iwp) ::  i    !: 
+    INTEGER(iwp) ::  io   !: 
 
 !
@@ -72,6 +79,6 @@
 !-- Format-descriptors
 100 FORMAT (//' *** no user-defined variables found'/)
-110 FORMAT (//1X,78('#')                                      &
-            //' User-defined variables and actions:'/  &
+110 FORMAT (//1X,78('#')                                                       &
+            //' User-defined variables and actions:'/                          &
               ' -----------------------------------'//)
 200 FORMAT (' Output of profiles and time series for following regions:' /)
Index: /palm/trunk/SOURCE/user_init.f90
===================================================================
--- /palm/trunk/SOURCE/user_init.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_init.f90	(revision 1320)
@@ -20,4 +20,8 @@
 ! Current revisions:
 ! -----------------
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
+!
 !
 ! Former revisions:
@@ -27,7 +31,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
 !
 ! 211 2008-11-11 04:46:24Z raasch
@@ -40,12 +41,18 @@
 
     USE control_parameters
+    
     USE indices
+    
+    USE kinds
+    
     USE netcdf_control
+    
     USE pegrid
+    
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=20) :: field_char
+    CHARACTER (LEN=20) :: field_char   !: 
 !
 !-- Here the user-defined initializing actions follow:
Index: /palm/trunk/SOURCE/user_init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/user_init_3d_model.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_init_3d_model.f90	(revision 1320)
@@ -41,6 +41,11 @@
 
     USE arrays_3d
+    
     USE control_parameters
+    
     USE indices
+    
+    USE kinds
+    
     USE user
 
Index: /palm/trunk/SOURCE/user_init_grid.f90
===================================================================
--- /palm/trunk/SOURCE/user_init_grid.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_init_grid.f90	(revision 1320)
@@ -20,4 +20,10 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 ! 
 !
@@ -28,9 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 258 2009-03-13 12:36:03Z heinze
-! Output of messages replaced by message handling routine.
-! add 'single_street_canyon' as standard topography case
-! -topography_grid_convention
 !
 ! 217 2008-12-09 18:00:48Z letzel
@@ -46,12 +47,18 @@
 
     USE control_parameters
+    
     USE indices
+    
+    USE kinds
+    
     USE user
 
     IMPLICIT NONE
 
-    INTEGER ::  gls
+    INTEGER(iwp) ::  gls   !: 
 
-    INTEGER, DIMENSION(-gls:ny+gls,-gls:nx+gls) ::  nzb_local
+    INTEGER(iwp),                                                              &
+       DIMENSION(-gls:ny+gls,-gls:nx+gls) ::                                   &
+          nzb_local   !: 
 
 !
Index: /palm/trunk/SOURCE/user_init_plant_canopy.f90
===================================================================
--- /palm/trunk/SOURCE/user_init_plant_canopy.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_init_plant_canopy.f90	(revision 1320)
@@ -20,4 +20,11 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
+!
 !
 ! Former revisions:
@@ -27,10 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng
-!
-! 274 2009-03-26 15:11:21Z heinze
-! Output of messages replaced by message handling routine.
 !
 ! 211 2008-11-11 04:46:24Z raasch
@@ -45,11 +46,17 @@
 
     USE arrays_3d
+    
     USE control_parameters
+    
     USE indices
+    
+    USE kinds
+    
     USE user
 
     IMPLICIT NONE
 
-    INTEGER :: i, j 
+    INTEGER(iwp) :: i   !: 
+    INTEGER(iwp) :: j   !: 
 
 !
Index: /palm/trunk/SOURCE/user_last_actions.f90
===================================================================
--- /palm/trunk/SOURCE/user_last_actions.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_last_actions.f90	(revision 1320)
@@ -20,4 +20,5 @@
 ! Current revisions:
 ! -----------------
+! revision history before 2012 removed,
 ! 
 !
@@ -28,7 +29,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 366 2009-08-25 08:06:27Z raasch
-! Output on unit 14 only if requested by write_binary
 !
 ! 211 2008-11-11 04:46:24Z raasch
@@ -41,4 +39,7 @@
 
     USE control_parameters
+        
+    USE kinds
+    
     USE user
 
Index: /palm/trunk/SOURCE/user_lpm_advec.f90
===================================================================
--- /palm/trunk/SOURCE/user_lpm_advec.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_lpm_advec.f90	(revision 1320)
@@ -20,4 +20,9 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 ! 
 !
@@ -40,10 +45,13 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+    
     USE particle_attributes
+    
     USE user
 
     IMPLICIT NONE
 
-    INTEGER ::  n
+    INTEGER(iwp) ::  n   !: 
 
 !
Index: /palm/trunk/SOURCE/user_lpm_init.f90
===================================================================
--- /palm/trunk/SOURCE/user_lpm_init.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_lpm_init.f90	(revision 1320)
@@ -20,4 +20,9 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 ! 
 !
@@ -40,10 +45,13 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+    
     USE particle_attributes
+    
     USE user
 
     IMPLICIT NONE
 
-    INTEGER ::  n
+    INTEGER(iwp) ::  n   !: 
 
 !
Index: /palm/trunk/SOURCE/user_lpm_set_attributes.f90
===================================================================
--- /palm/trunk/SOURCE/user_lpm_set_attributes.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_lpm_set_attributes.f90	(revision 1320)
@@ -20,4 +20,9 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 ! 
 !
@@ -40,10 +45,13 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+    
     USE particle_attributes
+    
     USE user
 
     IMPLICIT NONE
 
-    INTEGER ::  n
+    INTEGER(iwp) ::  n   !: 
 
 !
Index: /palm/trunk/SOURCE/user_module.f90
===================================================================
--- /palm/trunk/SOURCE/user_module.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_module.f90	(revision 1320)
@@ -20,4 +20,10 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 ! 
 !
@@ -28,22 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 220 2008-12-18 07:00:36Z raasch
-! Former file user_interface.f90 split into one file per subroutine,
-! revision history cleaned up
-!
-! 159 2008-04-09 08:06:03Z raasch
-! bugfix in user_read_restart_data
-! small bugfixes for sample code (comments):
-! - initialize ustvst with 0.0 as it is now computed only until nxr and nyn
-! - two ALLOCATE statements moved from user_read_restart_data back to user_init
-! - remove 'READ (13) u2_av' statement in user_read_restart_data
-! +routines user_read_restart_data, user_spectra
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.18  2006/06/02 15:25:00  raasch
-! +change of grid-defining arguments in routine user_define_netcdf_grid,
-! new argument "found" in user_data_output_2d and user_data_output_3d
 !
 ! Revision 1.1  1998/03/24 15:29:04  raasch
@@ -57,12 +45,20 @@
 !------------------------------------------------------------------------------!
 
-    INTEGER ::  dots_num_palm, user_idummy
-    LOGICAL ::  user_defined_namelist_found = .FALSE.
-    REAL    ::  user_rdummy
+    USE kinds
+
+    IMPLICIT NONE
+
+    INTEGER(iwp) ::  dots_num_palm   !: 
+    INTEGER(iwp) ::  user_idummy     !: 
+    
+    LOGICAL ::  user_defined_namelist_found = .FALSE.   !: 
+    
+    REAL(wp) ::  user_rdummy   !: 
 
 !
 !-- Sample for user-defined output
-!    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  u2, u2_av
-!    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  ustvst
+!    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  u2       !: user defined array
+!    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  u2_av    !: user defined array
+!    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ustvst   !: user defined array
 
     SAVE
Index: /palm/trunk/SOURCE/user_parin.f90
===================================================================
--- /palm/trunk/SOURCE/user_parin.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_parin.f90	(revision 1320)
@@ -20,4 +20,10 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 !
@@ -35,14 +41,4 @@
 ! Bugfix: disable max_pr_user check during prior namelist file check
 !
-! 553 2010-09-01 14:09:06Z weinreis
-! data_output_mask_user_* replaced by array data_output_masks_user
-!
-! 410 2009-12-04 17:05:40Z letzel
-! masked data output
-!
-! 274 2009-03-26 15:11:21Z heinze
-! Output of messages replaced by message handling routine.
-! topography_grid_convention moved to inipar
-!
 ! 217 2008-12-09 18:00:48Z letzel
 ! +topography_grid_convention
@@ -55,16 +51,23 @@
 
     USE control_parameters
+    
+    USE kinds
+    
     USE pegrid
+    
     USE statistics
+    
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=80) ::  zeile
+    CHARACTER (LEN=80) ::  zeile   !: 
 
-    INTEGER ::  i, j, max_pr_user_tmp
+    INTEGER(iwp) ::  i                 !: 
+    INTEGER(iwp) ::  j                 !: 
+    INTEGER(iwp) ::  max_pr_user_tmp   !: 
 
 
-    NAMELIST /userpar/  data_output_pr_user, data_output_user, region,  &
+    NAMELIST /userpar/  data_output_pr_user, data_output_user, region,         &
                         data_output_masks_user
 
@@ -110,8 +113,8 @@
     IF ( TRIM( initializing_actions ) == 'read_restart_data' )  THEN
        IF ( max_pr_user /= max_pr_user_tmp )  THEN
-          WRITE( message_string, * ) 'the number of user-defined profiles ', &
-                     'given in &data_output_pr (', max_pr_user_tmp, ') doe', &
-                     'snot match the one ',                                  &
-                     '&found in the restart file (', max_pr_user,            &
+          WRITE( message_string, * ) 'the number of user-defined profiles ',   &
+                     'given in &data_output_pr (', max_pr_user_tmp, ') doe',   &
+                     'snot match the one ',                                    &
+                     '&found in the restart file (', max_pr_user,              &
                                      ')'
           CALL message( 'user_parin', 'UI0009', 1, 2, 0, 6, 0 )
Index: /palm/trunk/SOURCE/user_read_restart_data.f90
===================================================================
--- /palm/trunk/SOURCE/user_read_restart_data.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_read_restart_data.f90	(revision 1320)
@@ -23,4 +23,11 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
+!
 !
 ! Former revisions:
@@ -30,17 +37,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 702 2011-03-24 19:33:15Z suehring
-! nys-1, nyn+1, nxl-1, nxr+1 changed to nysg, nyng, nxlg, nxrg.
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Allocation with nbgp
-!
-! 583 2010-10-11 09:28:42Z heinze
-! Bugfix: replace 'user_spectra' with 'user_read_restart_data' in call of 
-! message
-!
-! 274 2009-03-26 15:11:21Z heinze
-! Output of messages replaced by message handling routine.
 !
 ! 220 2008-12-18 07:00:36Z raasch
@@ -59,24 +53,47 @@
 
     USE control_parameters
+        
     USE indices
+    
+    USE kinds
+    
     USE pegrid
+    
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=20) :: field_char
+    CHARACTER (LEN=20) :: field_char   !: 
 
-    INTEGER ::  i, k, nxlc, nxlf, nxl_on_file, nxrc, nxrf, nxr_on_file, nync, &
-                nynf, nyn_on_file, nysc, nysf, nys_on_file, overlap_count
+    INTEGER(iwp) ::  i               !: 
+    INTEGER(iwp) ::  k               !: 
+    INTEGER(iwp) ::  nxlc            !: 
+    INTEGER(iwp) ::  nxlf            !: 
+    INTEGER(iwp) ::  nxl_on_file     !: 
+    INTEGER(iwp) ::  nxrc            !: 
+    INTEGER(iwp) ::  nxrf            !: 
+    INTEGER(iwp) ::  nxr_on_file     !: 
+    INTEGER(iwp) ::  nync            !: 
+    INTEGER(iwp) ::  nynf            !: 
+    INTEGER(iwp) ::  nyn_on_file     !: 
+    INTEGER(iwp) ::  nysc            !: 
+    INTEGER(iwp) ::  nysf            !: 
+    INTEGER(iwp) ::  nys_on_file     !: 
+    INTEGER(iwp) ::  overlap_count   !: 
 
-    INTEGER, DIMENSION(numprocs_previous_run,1000) ::  nxlfa, nxrfa, nynfa, &
-                                                       nysfa, offset_xa, &
-                                                       offset_ya
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nxlfa       !: 
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nxrfa       !: 
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nynfa       !: 
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  nysfa       !: 
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  offset_xa   !: 
+    INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) ::  offset_ya   !: 
 
-    REAL, DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: &
-          tmp_2d
+    REAL(wp),                                                                  &
+       DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::&
+          tmp_2d   !: 
 
-    REAL, DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: &
-          tmp_3d
+    REAL(wp),                                                                  &
+       DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) ::&
+          tmp_3d   !: 
 
 !
@@ -107,10 +124,10 @@
 !                   ENDIF
 !                   IF ( k == 1 )  READ ( 13 )  tmp_3d
-!                   u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &
+!                   u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
 !                                          tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 !
 !                CASE DEFAULT
-!                   WRITE( message_string, * ) 'unknown variable named "',  &
-!                                         TRIM( field_char ), '" found in', &
+!                   WRITE( message_string, * ) 'unknown variable named "',       &
+!                                         TRIM( field_char ), '" found in',      &
 !                                         '&data from prior run on PE ', myid
 !                   CALL message( 'user_read_restart_data', 'UI0012', 1, 2, 0, 6, 0 )
Index: /palm/trunk/SOURCE/user_spectra.f90
===================================================================
--- /palm/trunk/SOURCE/user_spectra.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_spectra.f90	(revision 1320)
@@ -20,4 +20,10 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !  
 !
@@ -28,7 +34,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 274 2009-03-26 15:11:21Z heinze
-! Output of messages replaced by message handling routine.
 !
 ! 211 2008-11-11 04:46:24Z raasch
@@ -43,8 +46,15 @@
 
     USE arrays_3d
+    
     USE control_parameters
+    
     USE indices
+    
+    USE kinds
+    
     USE spectrum
+    
     USE statistics
+    
     USE user
 
@@ -53,5 +63,9 @@
     CHARACTER (LEN=*) ::  mode
 
-    INTEGER ::  i, j, k, m, pr
+    INTEGER(iwp) ::  i    !: 
+    INTEGER(iwp) ::  j    !: 
+    INTEGER(iwp) ::  k    !: 
+    INTEGER(iwp) ::  m    !: 
+    INTEGER(iwp) ::  pr   !: 
 
 
@@ -75,5 +89,5 @@
        
           CASE DEFAULT
-             message_string = 'Spectra of ' // &
+             message_string = 'Spectra of ' //                                 &
                          TRIM( data_output_sp(m) ) // ' can not be calculated'
              CALL message( 'user_spectra', 'UI0010', 0, 0, 0, 6, 0 )
@@ -93,5 +107,5 @@
 
           CASE DEFAULT
-             message_string = 'Spectra of ' //  &
+             message_string = 'Spectra of ' //                                 &
                               TRIM( data_output_sp(m) ) // ' are not defined'
              CALL message( 'user_spectra', 'UI0011', 0, 0, 0, 6, 0 )
Index: /palm/trunk/SOURCE/user_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/user_statistics.f90	(revision 1319)
+++ /palm/trunk/SOURCE/user_statistics.f90	(revision 1320)
@@ -20,4 +20,11 @@
 ! Current revisions:
 ! -----------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
+!
 !
 ! Former revisions:
@@ -30,16 +37,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 678 2011-02-02 14:31:56Z raasch
-! Bugfix: module pegrid was missing
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! 555 2010-09-07 07:32:53Z raasch
-! Bugfix: wrong dimension used for ts_value_l
-!
-! 493 2010-03-01 08:30:24Z raasch
-! Bugfix: timeseries data have to be collected by PE0
 !
 ! 211 2008-11-11 04:46:24Z raasch
@@ -57,17 +52,30 @@
 
     USE arrays_3d
+    
     USE indices
+    
+    USE kinds
+    
     USE netcdf_control
+    
     USE pegrid
+    
     USE statistics
+    
     USE user
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=*) ::  mode
+    CHARACTER (LEN=*) ::  mode   !: 
 
-    INTEGER ::  i, j, k, sr, tn
+    INTEGER(iwp) ::  i    !: 
+    INTEGER(iwp) ::  j    !: 
+    INTEGER(iwp) ::  k    !: 
+    INTEGER(iwp) ::  sr   !: 
+    INTEGER(iwp) ::  tn   !: 
 
-    REAL, DIMENSION(dots_num_palm+1:dots_max) ::  ts_value_l
+    REAL(wp),                                                                  &
+       DIMENSION(dots_num_palm+1:dots_max) ::                                  &
+          ts_value_l   !: 
 
 
@@ -87,12 +95,12 @@
 !!--             Sample on how to calculate the profile of the resolved-scale
 !!--             horizontal momentum flux u*v*
-!                sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) +           &
-!                      ( 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) * &
-!                      ( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) )   &
+!                sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) +               &
+!                      ( 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) *     &
+!                      ( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) )       &
 !                                                 * rmask(j,i,sr)
 !!
 !!--             Further profiles can be defined and calculated by increasing
 !!--             the second index of array sums_l (replace ... appropriately)
-!                sums_l(k,pr_palm+2,tn) = sums_l(k,pr_palm+2,tn) + ... &
+!                sums_l(k,pr_palm+2,tn) = sums_l(k,pr_palm+2,tn) + ...           &
 !                                         * rmask(j,i,sr)
 !             ENDDO
@@ -121,7 +129,7 @@
 !#if defined( __parallel ) && ! defined ( __check )
 !       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-!       CALL MPI_ALLREDUCE( ts_value_l(dots_num_palm+1),                       &
-!                           ts_value(dots_num_palm+1,sr),                      &
-!                           dots_max-dots_num_palm, MPI_REAL, MPI_SUM, comm2d, &
+!       CALL MPI_ALLREDUCE( ts_value_l(dots_num_palm+1),                         &
+!                           ts_value(dots_num_palm+1,sr),                        &
+!                           dots_max-dots_num_palm, MPI_REAL, MPI_SUM, comm2d,   &
 !                           ierr )
 !#else
Index: /palm/trunk/SOURCE/wall_fluxes.f90
===================================================================
--- /palm/trunk/SOURCE/wall_fluxes.f90	(revision 1319)
+++ /palm/trunk/SOURCE/wall_fluxes.f90	(revision 1320)
@@ -20,4 +20,11 @@
 ! Current revisions:
 ! -----------------
+! ONLY-attribute added to USE-statements,
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 !
@@ -41,15 +48,4 @@
 ! 1015 2012-09-27 09:23:24Z raasch
 ! accelerator version (*_acc) added
-!
-! 187 2008-08-06 16:25:09Z letzel
-! Bugfix: Modification of the evaluation of the vertical turbulent momentum 
-! fluxes u'w' and v'w (see prandtl_fluxes), this requires the calculation of
-! us_wall (and vel_total, u_i, v_i, ws) also in wall_fluxes_e.
-! Bugfix: change definition of us_wall from 1D to 2D
-! Bugfix: storage of rifs to rifs_wall in wall_fluxes_e removed
-! Change: add 'minus' sign to fluxes produced by subroutine wall_fluxes_e for 
-! consistency with subroutine wall_fluxes
-! Change: Modification of the integrated version of the profile function for 
-! momentum for unstable stratification
 !
 ! Initial version (2007/03/07)
@@ -90,24 +86,62 @@
 ! Call for all grid points
 !------------------------------------------------------------------------------!
-    SUBROUTINE wall_fluxes( wall_flux, a, b, c1, c2, nzb_uvw_inner, &
+    SUBROUTINE wall_fluxes( wall_flux, a, b, c1, c2, nzb_uvw_inner,            &
                             nzb_uvw_outer, wall )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  rif_wall, u, v, w, z0, pt
+       
+       USE control_parameters,                                                 &
+           ONLY:  g, kappa, rif_max, rif_min
+       
+       USE grid_variables,                                                     &
+           ONLY:  dx, dy
+       
+       USE indices,                                                            &
+           ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
+       
+       USE kinds
+       
+       USE statistics,                                                         &
+           ONLY:  hom
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, wall_index
-
-       INTEGER, DIMENSION(nysg:nyng,nxlg:nxrg) ::  nzb_uvw_inner, &
-                                                       nzb_uvw_outer
-       REAL ::  a, b, c1, c2, h1, h2, zp
-       REAL ::  pts, pt_i, rifs, u_i, v_i, us_wall, vel_total, ws, wspts
-
-       REAL, DIMENSION(nysg:nyng,nxlg:nxrg)   ::  wall
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wall_flux
+       INTEGER(iwp) ::  i            !: 
+       INTEGER(iwp) ::  j            !: 
+       INTEGER(iwp) ::  k            !: 
+       INTEGER(iwp) ::  wall_index   !: 
+
+       INTEGER(iwp),                                                           &
+          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
+             nzb_uvw_inner   !: 
+       INTEGER(iwp),                                                           &
+          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
+             nzb_uvw_outer   !: 
+       
+       REAL(wp) ::  a           !: 
+       REAL(wp) ::  b           !: 
+       REAL(wp) ::  c1          !: 
+       REAL(wp) ::  c2          !: 
+       REAL(wp) ::  h1          !: 
+       REAL(wp) ::  h2          !: 
+       REAL(wp) ::  zp          !: 
+       REAL(wp) ::  pts         !: 
+       REAL(wp) ::  pt_i        !: 
+       REAL(wp) ::  rifs        !: 
+       REAL(wp) ::  u_i         !: 
+       REAL(wp) ::  v_i         !: 
+       REAL(wp) ::  us_wall     !: 
+       REAL(wp) ::  vel_total   !: 
+       REAL(wp) ::  ws          !: 
+       REAL(wp) ::  wspts       !: 
+
+       REAL(wp),                                                               &
+          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
+             wall   !: 
+       
+       REAL(wp),                                                               &
+          DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::                              &
+             wall_flux   !: 
 
 
@@ -129,8 +163,8 @@
                    rifs  = rif_wall(k,j,i,wall_index)
 
-                   u_i   = a * u(k,j,i) + c1 * 0.25 * &
+                   u_i   = a * u(k,j,i) + c1 * 0.25 *                          &
                            ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) )
 
-                   v_i   = b * v(k,j,i) + c2 * 0.25 * &
+                   v_i   = b * v(k,j,i) + c2 * 0.25 *                          &
                            ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) )
 
@@ -139,5 +173,5 @@
                    + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) &
                                                            )
-                   pt_i  = 0.5 * ( pt(k,j,i) + a *  pt(k,j,i-1) + &
+                   pt_i  = 0.5 * ( pt(k,j,i) + a *  pt(k,j,i-1) +              &
                                    b * pt(k,j-1,i) + ( c1 + c2 ) * pt(k+1,j,i) )
 
@@ -176,5 +210,5 @@
 !--                (4) Compute zp/L (corresponds to neutral Richardson flux
 !--                    number rifs)
-                   rifs = -1.0 * zp * kappa * g * wspts / ( pt_i * &
+                   rifs = -1.0 * zp * kappa * g * wspts / ( pt_i *             &
                                                         ( us_wall**3 + 1E-30 ) )
 
@@ -234,24 +268,65 @@
 ! Call for all grid points - accelerator version
 !------------------------------------------------------------------------------!
-    SUBROUTINE wall_fluxes_acc( wall_flux, a, b, c1, c2, nzb_uvw_inner, &
+    SUBROUTINE wall_fluxes_acc( wall_flux, a, b, c1, c2, nzb_uvw_inner,        &
                                 nzb_uvw_outer, wall )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  rif_wall, pt, u, v, w, z0
+       
+       USE control_parameters,                                                 &
+           ONLY:  g, kappa, rif_max, rif_min
+       
+       USE grid_variables,                                                     &
+           ONLY:  dx, dy
+       
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nxl, nxlg, nxr, nxrg,     &
+                  nyn, nyng, nys, nysg, nzb, nzt
+       
+       USE kinds
+       
+       USE statistics,                                                         &
+           ONLY:  hom
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, max_outer, min_inner, wall_index
-
-       INTEGER, DIMENSION(nysg:nyng,nxlg:nxrg) ::  nzb_uvw_inner, &
-                                                   nzb_uvw_outer
-       REAL ::  a, b, c1, c2, h1, h2, zp
-       REAL ::  pts, pt_i, rifs, u_i, v_i, us_wall, vel_total, ws, wspts
-
-       REAL, DIMENSION(nysg:nyng,nxlg:nxrg)   ::  wall
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wall_flux
+       INTEGER(iwp) ::  i            !: 
+       INTEGER(iwp) ::  j            !: 
+       INTEGER(iwp) ::  k            !: 
+       INTEGER(iwp) ::  max_outer    !: 
+       INTEGER(iwp) ::  min_inner    !: 
+       INTEGER(iwp) ::  wall_index   !: 
+
+       INTEGER(iwp),                                                           &
+          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
+             nzb_uvw_inner   !: 
+       INTEGER(iwp),                                                           &
+          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
+             nzb_uvw_outer   !: 
+       
+       REAL(wp) ::  a           !: 
+       REAL(wp) ::  b           !: 
+       REAL(wp) ::  c1          !: 
+       REAL(wp) ::  c2          !: 
+       REAL(wp) ::  h1          !: 
+       REAL(wp) ::  h2          !: 
+       REAL(wp) ::  zp          !: 
+       REAL(wp) ::  pts         !: 
+       REAL(wp) ::  pt_i        !: 
+       REAL(wp) ::  rifs        !: 
+       REAL(wp) ::  u_i         !: 
+       REAL(wp) ::  v_i         !: 
+       REAL(wp) ::  us_wall     !: 
+       REAL(wp) ::  vel_total   !: 
+       REAL(wp) ::  ws          !: 
+       REAL(wp) ::  wspts       !: 
+
+       REAL(wp),                                                               &
+          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
+             wall   !: 
+       
+       REAL(wp),                                                               &
+          DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::                              &
+             wall_flux   !: 
 
 
@@ -280,8 +355,8 @@
                    rifs  = rif_wall(k,j,i,wall_index)
 
-                   u_i   = a * u(k,j,i) + c1 * 0.25 * &
+                   u_i   = a * u(k,j,i) + c1 * 0.25 *                          &
                            ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) )
 
-                   v_i   = b * v(k,j,i) + c2 * 0.25 * &
+                   v_i   = b * v(k,j,i) + c2 * 0.25 *                          &
                            ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) )
 
@@ -290,5 +365,5 @@
                    + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) &
                                                            )
-                   pt_i  = 0.5 * ( pt(k,j,i) + a *  pt(k,j,i-1) + &
+                   pt_i  = 0.5 * ( pt(k,j,i) + a *  pt(k,j,i-1) +              &
                                    b * pt(k,j-1,i) + ( c1 + c2 ) * pt(k+1,j,i) )
 
@@ -327,5 +402,5 @@
 !--                (4) Compute zp/L (corresponds to neutral Richardson flux
 !--                    number rifs)
-                   rifs = -1.0 * zp * kappa * g * wspts / ( pt_i * &
+                   rifs = -1.0 * zp * kappa * g * wspts / ( pt_i *             &
                                                         ( us_wall**3 + 1E-30 ) )
 
@@ -372,6 +447,4 @@
                    rif_wall(k,j,i,wall_index) = rifs
 
-!                ENDIF
-
                 ENDDO
 
@@ -390,18 +463,48 @@
     SUBROUTINE wall_fluxes_ij( i, j, nzb_w, nzt_w, wall_flux, a, b, c1, c2 )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  rif_wall, pt, u, v, w, z0
+       
+       USE control_parameters,                                                 &
+           ONLY:  g, kappa, rif_max, rif_min
+       
+       USE grid_variables,                                                     &
+           ONLY:  dx, dy
+       
+       USE indices,                                                            &
+           ONLY:  nzb, nzt
+       
+       USE kinds
+       
+       USE statistics,                                                         &
+           ONLY:  hom
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, nzb_w, nzt_w, wall_index
-       REAL    ::  a, b, c1, c2, h1, h2, zp
-
-       REAL ::  pts, pt_i, rifs, u_i, v_i, us_wall, vel_total, ws, wspts
-
-       REAL, DIMENSION(nzb:nzt+1) ::  wall_flux
+       INTEGER(iwp) ::  i            !: 
+       INTEGER(iwp) ::  j            !: 
+       INTEGER(iwp) ::  k            !: 
+       INTEGER(iwp) ::  nzb_w        !: 
+       INTEGER(iwp) ::  nzt_w        !: 
+       INTEGER(iwp) ::  wall_index   !: 
+       
+       REAL(wp) ::  a           !: 
+       REAL(wp) ::  b           !: 
+       REAL(wp) ::  c1          !: 
+       REAL(wp) ::  c2          !: 
+       REAL(wp) ::  h1          !: 
+       REAL(wp) ::  h2          !: 
+       REAL(wp) ::  zp          !: 
+       REAL(wp) ::  pts         !: 
+       REAL(wp) ::  pt_i        !: 
+       REAL(wp) ::  rifs        !: 
+       REAL(wp) ::  u_i         !: 
+       REAL(wp) ::  v_i         !: 
+       REAL(wp) ::  us_wall     !: 
+       REAL(wp) ::  vel_total   !: 
+       REAL(wp) ::  ws          !: 
+       REAL(wp) ::  wspts       !: 
+
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  wall_flux   !: 
 
 
@@ -419,8 +522,8 @@
           rifs  = rif_wall(k,j,i,wall_index)
 
-          u_i   = a * u(k,j,i) + c1 * 0.25 * &
+          u_i   = a * u(k,j,i) + c1 * 0.25 *                                   &
                   ( u(k+1,j,i+1) + u(k+1,j,i) + u(k,j,i+1) + u(k,j,i) )
 
-          v_i   = b * v(k,j,i) + c2 * 0.25 * &
+          v_i   = b * v(k,j,i) + c2 * 0.25 *                                   &
                   ( v(k+1,j+1,i) + v(k+1,j,i) + v(k,j+1,i) + v(k,j,i) )
 
@@ -429,5 +532,5 @@
                    + b * ( w(k-1,j-1,i) + w(k-1,j,i) + w(k,j-1,i) + w(k,j,i) ) &
                                                   )
-          pt_i  = 0.5 * ( pt(k,j,i) + a *  pt(k,j,i-1) + b * pt(k,j-1,i)  &
+          pt_i  = 0.5 * ( pt(k,j,i) + a *  pt(k,j,i-1) + b * pt(k,j-1,i)       &
                           + ( c1 + c2 ) * pt(k+1,j,i) )
 
@@ -455,9 +558,9 @@
              h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
 
-             us_wall = kappa * vel_total / (                          &
-                  LOG( zp / z0(j,i) ) -                               &
-                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+             us_wall = kappa * vel_total / (                                   &
+                  LOG( zp / z0(j,i) ) -                                        &
+                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (                   &
+                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +               &
+                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )                       &
                                            )
           ENDIF
@@ -483,8 +586,8 @@
 !
 !--          Stable stratification (and neutral)
-             wall_flux(k) = kappa *                                          &
-                            ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / &
-                            (  LOG( zp / z0(j,i) ) +                         &
-                               5.0 * rifs * ( zp - z0(j,i) ) / zp            &
+             wall_flux(k) = kappa *                                            &
+                            ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) /   &
+                            (  LOG( zp / z0(j,i) ) +                           &
+                               5.0 * rifs * ( zp - z0(j,i) ) / zp              &
                             )
           ELSE
@@ -495,10 +598,10 @@
              h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
 
-             wall_flux(k) = kappa *                               &
-                  ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / (  &
-                  LOG( zp / z0(j,i) ) -                               &
-                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+             wall_flux(k) = kappa *                                            &
+                  ( a*u(k,j,i) + b*v(k,j,i) + (c1+c2)*w(k,j,i) ) / (           &
+                  LOG( zp / z0(j,i) ) -                                        &
+                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (                   &
+                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +               &
+                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )                       &
                                                                    )
           ENDIF
@@ -528,20 +631,49 @@
 !------------------------------------------------------------------------------!
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  rif_wall, u, v, w, z0
+       
+       USE control_parameters,                                                 &
+           ONLY:  kappa
+       
+       USE grid_variables,                                                     &
+           ONLY:  dx, dy
+       
+       USE indices,                                                            &
+           ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb,             &
+                  nzb_diff_s_inner, nzb_diff_s_outer, nzt
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, kk, wall_index
-       REAL    ::  a, b, c1, c2, h1, h2, u_i, v_i, us_wall, vel_total, vel_zp, &
-                   ws, zp
-
-       REAL ::  rifs
-
-       REAL, DIMENSION(nysg:nyng,nxlg:nxrg)   ::  wall
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wall_flux
+       INTEGER(iwp) ::  i            !: 
+       INTEGER(iwp) ::  j            !: 
+       INTEGER(iwp) ::  k            !: 
+       INTEGER(iwp) ::  kk           !: 
+       INTEGER(iwp) ::  wall_index   !: 
+       
+       REAL(wp) ::  a           !: 
+       REAL(wp) ::  b           !: 
+       REAL(wp) ::  c1          !: 
+       REAL(wp) ::  c2          !: 
+       REAL(wp) ::  h1          !: 
+       REAL(wp) ::  h2          !: 
+       REAL(wp) ::  u_i         !: 
+       REAL(wp) ::  v_i         !: 
+       REAL(wp) ::  us_wall     !: 
+       REAL(wp) ::  vel_total   !: 
+       REAL(wp) ::  vel_zp      !: 
+       REAL(wp) ::  ws          !: 
+       REAL(wp) ::  zp          !: 
+       REAL(wp) ::  rifs        !: 
+
+       REAL(wp),                                                               &
+          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
+             wall   !: 
+       
+       REAL(wp),                                                               &
+          DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::                              &
+             wall_flux   !: 
 
 
@@ -611,5 +743,5 @@
 !
 !--                   Stable stratification (and neutral)
-                      wall_flux(k,j,i) = kappa *  vel_zp / &
+                      wall_flux(k,j,i) = kappa *  vel_zp /                     &
                           ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp )
                    ELSE
@@ -652,20 +784,52 @@
 !------------------------------------------------------------------------------!
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  rif_wall, u, v, w, z0
+       
+       USE control_parameters,                                                 &
+           ONLY:  kappa
+       
+       USE grid_variables,                                                     &
+           ONLY:  dx, dy
+       
+       USE indices,                                                            &
+           ONLY:  i_left, i_right, j_north, j_south, nxl, nxlg, nxr, nxrg,     &
+                  nyn, nyng, nys, nysg, nzb, nzb_diff_s_inner,                 &
+                  nzb_diff_s_outer, nzt
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, kk, max_outer, min_inner, wall_index
-       REAL    ::  a, b, c1, c2, h1, h2, u_i, v_i, us_wall, vel_total, vel_zp, &
-                   ws, zp
-
-       REAL ::  rifs
-
-       REAL, DIMENSION(nysg:nyng,nxlg:nxrg)   ::  wall
-       REAL, DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::  wall_flux
+       INTEGER(iwp) ::  i            !: 
+       INTEGER(iwp) ::  j            !: 
+       INTEGER(iwp) ::  k            !: 
+       INTEGER(iwp) ::  kk           !: 
+       INTEGER(iwp) ::  max_outer    !: 
+       INTEGER(iwp) ::  min_inner    !: 
+       INTEGER(iwp) ::  wall_index   !: 
+       
+       REAL(wp) ::  a           !: 
+       REAL(wp) ::  b           !: 
+       REAL(wp) ::  c1          !: 
+       REAL(wp) ::  c2          !: 
+       REAL(wp) ::  h1          !: 
+       REAL(wp) ::  h2          !: 
+       REAL(wp) ::  u_i         !: 
+       REAL(wp) ::  v_i         !: 
+       REAL(wp) ::  us_wall     !: 
+       REAL(wp) ::  vel_total   !: 
+       REAL(wp) ::  vel_zp      !: 
+       REAL(wp) ::  ws          !: 
+       REAL(wp) ::  zp          !: 
+       REAL(wp) ::  rifs        !: 
+
+       REAL(wp),                                                               &
+          DIMENSION(nysg:nyng,nxlg:nxrg) ::                                    &
+             wall   !: 
+       
+       REAL(wp),                                                               &
+          DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) ::                              &
+             wall_flux   !: 
 
 
@@ -684,5 +848,5 @@
 !
 !--             All subsequent variables are computed for scalar locations
-                IF ( k >= nzb_diff_s_inner(j,i)-1  .AND. &
+                IF ( k >= nzb_diff_s_inner(j,i)-1  .AND.                       &
                      k <= nzb_diff_s_outer(j,i)-2  .AND.  wall(j,i) /= 0.0 )  THEN
 !
@@ -740,5 +904,5 @@
 !
 !--                   Stable stratification (and neutral)
-                      wall_flux(k,j,i) = kappa *  vel_zp / &
+                      wall_flux(k,j,i) = kappa *  vel_zp /                     &
                           ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp )
                    ELSE
@@ -773,19 +937,44 @@
     SUBROUTINE wall_fluxes_e_ij( i, j, nzb_w, nzt_w, wall_flux, a, b, c1, c2 )
 
-       USE arrays_3d
-       USE control_parameters
-       USE grid_variables
-       USE indices
-       USE statistics
+       USE arrays_3d,                                                          &
+           ONLY:  rif_wall, u, v, w, z0
+       
+       USE control_parameters,                                                 &
+           ONLY:  kappa
+       
+       USE grid_variables,                                                     &
+           ONLY:  dx, dy
+       
+       USE indices,                                                            &
+           ONLY:  nzb, nzt
+       
+       USE kinds
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j, k, kk, nzb_w, nzt_w, wall_index
-       REAL    ::  a, b, c1, c2, h1, h2, u_i, v_i, us_wall, vel_total, vel_zp, &
-                   ws, zp
-
-       REAL ::  rifs
-
-       REAL, DIMENSION(nzb:nzt+1) ::  wall_flux
+       INTEGER(iwp) ::  i            !: 
+       INTEGER(iwp) ::  j            !: 
+       INTEGER(iwp) ::  k            !: 
+       INTEGER(iwp) ::  kk           !: 
+       INTEGER(iwp) ::  nzb_w        !: 
+       INTEGER(iwp) ::  nzt_w        !: 
+       INTEGER(iwp) ::  wall_index   !: 
+       
+       REAL(wp) ::  a           !: 
+       REAL(wp) ::  b           !: 
+       REAL(wp) ::  c1          !: 
+       REAL(wp) ::  c2          !: 
+       REAL(wp) ::  h1          !: 
+       REAL(wp) ::  h2          !: 
+       REAL(wp) ::  u_i         !: 
+       REAL(wp) ::  v_i         !: 
+       REAL(wp) ::  us_wall     !: 
+       REAL(wp) ::  vel_total   !: 
+       REAL(wp) ::  vel_zp      !: 
+       REAL(wp) ::  ws          !: 
+       REAL(wp) ::  zp          !: 
+       REAL(wp) ::  rifs        !: 
+
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  wall_flux   !: 
 
 
@@ -834,9 +1023,9 @@
              h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
 
-             us_wall = kappa * vel_total / (                          &
-                  LOG( zp / z0(j,i) ) -                               &
-                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+             us_wall = kappa * vel_total / (                                   &
+                  LOG( zp / z0(j,i) ) -                                        &
+                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (                   &
+                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +               &
+                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )                       &
                                            )
           ENDIF
@@ -850,7 +1039,7 @@
 !--       subroutine wall_fluxes because fluxes in subroutine 
 !--       wall_fluxes_e are defined at scalar locations).
-          vel_zp = 0.5 * (       a * ( u(k,j,i) + u(k,j,i+1) ) +  &
-                                 b * ( v(k,j,i) + v(k,j+1,i) ) +  &
-                           (c1+c2) * ( w(k,j,i) + w(k-1,j,i) )    &
+          vel_zp = 0.5 * (       a * ( u(k,j,i) + u(k,j,i+1) ) +               &
+                                 b * ( v(k,j,i) + v(k,j+1,i) ) +               &
+                           (c1+c2) * ( w(k,j,i) + w(k-1,j,i) )                 &
                          )
 
@@ -859,5 +1048,5 @@
 !
 !--          Stable stratification (and neutral)
-             wall_flux(k) = kappa *  vel_zp / &
+             wall_flux(k) = kappa *  vel_zp /                                  &
                           ( LOG( zp/z0(j,i) ) + 5.0*rifs * ( zp-z0(j,i) ) / zp )
           ELSE
@@ -868,9 +1057,9 @@
              h2 = SQRT( SQRT( 1.0 - 16.0 * rifs * z0(j,i) / zp ) )
 
-             wall_flux(k) = kappa * vel_zp / (                        &
-                  LOG( zp / z0(j,i) ) -                               &
-                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (          &
-                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +      &
-                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )              &
+             wall_flux(k) = kappa * vel_zp / (                                 &
+                  LOG( zp / z0(j,i) ) -                                        &
+                  LOG( ( 1.0 + h1 )**2 * ( 1.0 + h1**2 ) / (                   &
+                       ( 1.0 + h2 )**2 * ( 1.0 + h2**2 )   ) ) +               &
+                       2.0 * ( ATAN( h1 ) - ATAN( h2 ) )                       &
                                                  )
           ENDIF
Index: /palm/trunk/SOURCE/write_3d_binary.f90
===================================================================
--- /palm/trunk/SOURCE/write_3d_binary.f90	(revision 1319)
+++ /palm/trunk/SOURCE/write_3d_binary.f90	(revision 1320)
@@ -20,4 +20,8 @@
 ! Current revisions:
 ! -----------------
+! ONLY-attribute added to USE-statements,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 !
@@ -46,46 +50,4 @@
 ! +z0h, z0h_av
 !
-! 790 2011-11-29 03:11:20Z raasch
-! bugfix: output of 'ql' also if cloud droplets are used
-!
-! 776 2011-10-31 08:02:51Z heinze
-! bugfix: increase binary_version due to last commit
-!
-! 771 2011-10-27 10:56:21Z heinze
-! +lpt
-!
-! 759 2011-09-15 13:58:31Z raasch
-! cpu measurement and file opening moved to main program
-!
-! 587 2010-10-27 08:36:51Z helmke
-! nothing done but text written for "Current revisions" by mistake
-!
-! 367 2009-08-25 08:35:52Z maronga
-! +shf_av, qsws_av
-!
-! 145 2008-01-09 08:17:38Z raasch
-! write_var_list is only called for pe0, -dopr_time_count,
-! hom_sum moved, volume_flow_area, volume_flow_initial moved to write_var_list,
-! writing of old profil parameters (cross_..., dopr_crossindex, profile_***)
-! removed
-!
-! 102 2007-07-27 09:09:17Z raasch
-! +uswst, uswst_m, vswst, vswst_m
-!
-! 96 2007-06-04 08:07:41Z raasch
-! +rho_av, sa, sa_av, saswsb, saswst
-!
-! 75 2007-03-22 09:54:05Z raasch
-! +precipitation_amount, precipitation_rate_av, rif_wall, u_m_l, u_m_r, etc.,
-! z0_av, moisture renamed humidity
-!
-! 19 2007-02-23 04:53:48Z raasch
-! +qswst, qswst_m, tswst, tswst_m
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.21  2006/08/04 15:05:11  raasch
-! +iran, iran_part
-!
 ! Revision 1.1  1998/03/18 20:20:21  raasch
 ! Initial revision
@@ -97,19 +59,37 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
+    USE arrays_3d,                                                             &
+        ONLY:  e, kh, km, p, pt, q, ql, qc, nr, nrs, nrsws, nrswst, qr, qrs,   &
+               qrsws, qrswst, qs, qsws, qswst, sa, saswsb, saswst, rif,        &
+               rif_wall, shf, ts, tswst, u, u_m_l, u_m_n, u_m_r, u_m_s, us,    &
+               usws, uswst, v, v_m_l, v_m_n, v_m_r, v_m_s, vpt, vsws, vswst,   &
+               w, w_m_l, w_m_n, w_m_r, w_m_s, z0, z0h
+        
     USE averaging
-    USE cloud_parameters
-    USE control_parameters
-    USE cpulog
-    USE indices
-    USE particle_attributes
+        
+    USE cloud_parameters,                                                      &
+        ONLY:  prr, precipitation_amount
+        
+    USE control_parameters,                                                    &
+        ONLY:  iran, humidity, passive_scalar, cloud_physics, cloud_droplets,  &
+               icloud_scheme, precipitation, ocean, topography
+                
+    USE indices,                                                               &
+        ONLY:  nxl, nxr, nys, nyn, nzb, nzt
+        
+    USE particle_attributes,                                                               &
+        ONLY:  iran_part
+        
     USE pegrid
-    USE profil_parameter
-    USE random_function_mod
-    USE statistics
+    
+    USE random_function_mod,                                                               &
+        ONLY:  random_iv, random_iy
+        
+    USE statistics,                                                            &
+        ONLY:  spectrum_x, spectrum_y
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=10) ::  binary_version
+    CHARACTER (LEN=10) ::  binary_version   !: 
 
 
@@ -165,5 +145,5 @@
     ENDIF
     IF ( ALLOCATED( precipitation_rate_av ) )  THEN
-       WRITE ( 14 )  'precipitation_rate_a';  WRITE ( 14 )  &
+       WRITE ( 14 )  'precipitation_rate_a';  WRITE ( 14 )                     &
                                                            precipitation_rate_av
     ENDIF
@@ -333,2 +313,3 @@
 
  END SUBROUTINE write_3d_binary
+ 
Index: /palm/trunk/SOURCE/write_compressed.f90
===================================================================
--- /palm/trunk/SOURCE/write_compressed.f90	(revision 1319)
+++ /palm/trunk/SOURCE/write_compressed.f90	(revision 1320)
@@ -21,4 +21,10 @@
 ! Current revisions:
 ! ------------------
+! kind-parameters added to all INTEGER and REAL declaration statements, 
+! kinds are defined in new module kinds, 
+! old module precision_kind is removed,
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 ! 
 !
@@ -32,16 +38,4 @@
 ! 1036 2012-10-22 13:43:42Z raasch
 ! code put under GPL (PALM 3.9)
-!
-! 667 2010-12-23 12:06:00Z suehring/gryschka
-! Array bounds and nx, ny adapted with nbgp
-!
-! 622 2010-12-10 08:08:13Z raasch
-! optional barriers included in order to speed up collective operations
-!
-! Feb. 2007
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.4  2006/02/23 13:15:09  raasch
-! nz_plot3d renamed nz_do3d
 !
 ! Revision 1.1  1999/03/02 09:25:21  raasch
@@ -69,21 +63,47 @@
 !------------------------------------------------------------------------------!
 
+    USE kinds
+    
     USE pegrid         !  needed for MPI_ALLREDUCE
 
     IMPLICIT NONE
 
-    INTEGER, PARAMETER   :: ip4 = SELECTED_INT_KIND ( 9 )
-    INTEGER, PARAMETER   :: spk = SELECTED_REAL_KIND( 6 )
-
-    INTEGER ::  ampl, dummy1, dummy2, factor, i, ifieldmax, ifieldmax_l, &
-                ifieldmin, ifieldmin_l, ii, length, nfree, npack, nsize, &
-                nx, ny, nz, startpos
-    INTEGER(ip4) ::  imask (32)
-    INTEGER(ip4), DIMENSION(:), ALLOCATABLE ::  ifield, packed_ifield
-
-    INTEGER, INTENT(IN) ::  fid_avs, fid_fld, my_id, nxl, nxr, nyn, nys, nzb, &
-                            nz_do3d, prec, nbgp
-
-    REAL(spk), INTENT(IN) :: field(1:((nxr-nxl+1+2*nbgp)*(nyn-nys+1+2*nbgp)*(nz_do3d-nzb+1)))
+    INTEGER(iwp) ::  ampl          !: 
+    INTEGER(iwp) ::  dummy1        !: 
+    INTEGER(iwp) ::  dummy2        !: 
+    INTEGER(iwp) ::  factor        !: 
+    INTEGER(iwp) ::  i             !: 
+    INTEGER(iwp) ::  ifieldmax     !: 
+    INTEGER(iwp) ::  ifieldmax_l   !: 
+    INTEGER(iwp) ::  ifieldmin     !: 
+    INTEGER(iwp) ::  ifieldmin_l   !: 
+    INTEGER(iwp) ::  ii            !: 
+    INTEGER(iwp) ::  length        !: 
+    INTEGER(iwp) ::  nfree         !: 
+    INTEGER(iwp) ::  npack         !: 
+    INTEGER(iwp) ::  nsize         !: 
+    INTEGER(iwp) ::  nx            !: 
+    INTEGER(iwp) ::  ny            !: 
+    INTEGER(iwp) ::  nz            !: 
+    INTEGER(iwp) ::  startpos      !: 
+    
+    INTEGER(isp) ::  imask (32)    !: 
+    
+    INTEGER(isp), DIMENSION(:), ALLOCATABLE ::  ifield          !: 
+    INTEGER(isp), DIMENSION(:), ALLOCATABLE ::  packed_ifield   !: 
+
+    INTEGER, INTENT(IN) ::  fid_avs   !: 
+    INTEGER, INTENT(IN) ::  fid_fld   !: 
+    INTEGER, INTENT(IN) ::  my_id     !: 
+    INTEGER, INTENT(IN) ::  nxl       !: 
+    INTEGER, INTENT(IN) ::  nxr       !: 
+    INTEGER, INTENT(IN) ::  nyn       !: 
+    INTEGER, INTENT(IN) ::  nys       !: 
+    INTEGER, INTENT(IN) ::  nzb       !: 
+    INTEGER, INTENT(IN) ::  nz_do3d   !: 
+    INTEGER, INTENT(IN) ::  prec      !: 
+    INTEGER, INTENT(IN) ::  nbgp      !: 
+
+    REAL(sp), INTENT(IN) ::  field(1:((nxr-nxl+1+2*nbgp)*(nyn-nys+1+2*nbgp)*(nz_do3d-nzb+1)))   !: 
 
 !
@@ -121,8 +141,8 @@
 #if defined( __parallel )
     IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-    CALL MPI_ALLREDUCE( ifieldmax_l, ifieldmax, 1, MPI_INTEGER, MPI_MAX, &
+    CALL MPI_ALLREDUCE( ifieldmax_l, ifieldmax, 1, MPI_INTEGER, MPI_MAX,       &
                         comm2d, ierr )
     IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-    CALL MPI_ALLREDUCE( ifieldmin_l, ifieldmin, 1, MPI_INTEGER, MPI_MIN, &
+    CALL MPI_ALLREDUCE( ifieldmin_l, ifieldmin, 1, MPI_INTEGER, MPI_MIN,       &
                         comm2d, ierr )
 #else
@@ -236,7 +256,7 @@
 !
 !-- Formats
-100 FORMAT ('# precision = ',I4/ &
-            '# feldmin   = ',I8/ &
-            '# nbits     = ',I2/ &
+100 FORMAT ('# precision = ',I4/                                               &
+            '# feldmin   = ',I8/                                               &
+            '# nbits     = ',I2/                                               &
             '# nskip     = ',I8)
 
Index: /palm/trunk/SOURCE/write_var_list.f90
===================================================================
--- /palm/trunk/SOURCE/write_var_list.f90	(revision 1319)
+++ /palm/trunk/SOURCE/write_var_list.f90	(revision 1320)
@@ -20,4 +20,7 @@
 ! Current revisions:
 ! -----------------
+! revision history before 2012 removed,
+! comment fields (!:) to be used for variable explanations added to
+! all variable declaration statements 
 !
 !
@@ -85,71 +88,4 @@
 ! +curvature_solution_effects
 !
-! 622 2010-12-10 08:08:13Z raasch
-! +collective_wait
-!
-! 600 2010-11-24 16:10:51Z raasch
-! +call_psolver_at_all_substeps, cfl_factor, cycle_mg, mg_cycles,
-! mg_switch_to_pe0_level, ngsrb, nsor, omega_sor, psolver,
-! rayleigh_damping_factor, rayleigh_damping_height, residual_limit
-!
-! 589 2010-10-27 14:21:29Z heinze
-! bugfix: character string of subs_vertical_gradient and 
-! subs_vertical_gradient_level shortened to 30 characters
-!
-! 587 2010-10-27 08:36:51Z helmke
-! +time_domask
-!
-! 580 2010-10-05 13:59:11Z heinze
-! Renaming of ws_vertical_gradient to subs_vertical_gradient,
-! ws_vertical_gradient_level to subs_vertical_gradient_level and
-! ws_vertical_gradient_level_ind to subs_vertical_gradient_level_i
-!
-! 411 2009-12-11 14:15:58Z heinze
-! +large_scale_subsidence, ws_vertical_gradient, ws_vertical_gradient_level,
-! ws_vertical_gradient_level_ind
-!
-! 345 2009-07-01 14:37:56Z heinze
-! +output_for_t0 
-! bugfix: -dt_fixed, because otherwise, restart runs cannot change from a
-! fixed to a free timestep.
-! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
-! canyon_wall_south, conserve_volume_flow_mode, coupling_start_time,
-! dp_external, dp_level_b, dp_smooth, dpdxy, run_coupled,
-! time_since_reference_point, topography_grid_convention, u_bulk, v_bulk
-!
-! 153 2008-03-19 09:41:30Z steinfeld
-! +cthf, leaf_surface_concentration, scalar_exchange_coefficient
-! +numprocs, hor_index_bounds, inflow_damping_height, inflow_damping_width,
-! mean_inflow_profiles, recycling_width, turbulent_inflow,
-! -cross_ts_*, npex, npey
-! hom_sum, volume_flow_area, volume_flow_initial moved from write_3d_binary
-! to here
-!
-! 138 2007-11-28 10:03:58Z letzel
-! +canopy_mode, drag_coefficient, lad, lad_surface, lad_vertical_gradient, 
-! lad_vertical_gradient_level, lad_vertical_gradient_level_ind, pch_index,
-! plant_canopy, time_sort_particles
-!
-! 102 2007-07-27 09:09:17Z raasch
-! +top_momentumflux_u|v, time_coupling
-!
-! 95 2007-06-02 16:48:38Z raasch
-! +bc_sa_t, ocean, sa_init, sa_surface, sa_vertical_gradient,
-! sa_vertical_gradient_level, bottom/top_salinity_flux
-!
-! 87 2007-05-22 15:46:47Z raasch
-! +max_pr_user (version 3.1)
-!
-! 75 2007-03-22 09:54:05Z raasch
-! +loop_optimization, pt_refrence, moisture renamed humidity
-!
-! 20 2007-02-26 00:12:32Z raasch
-! +top_heatflux, use_top_fluxes
-!
-! RCS Log replace by Id keyword, revision history cleaned up
-!
-! Revision 1.34  2006/08/22 14:30:52  raasch
-! +dz_max
-!
 ! Revision 1.1  1998/03/18 20:20:38  raasch
 ! Initial revision
@@ -162,20 +98,38 @@
 !------------------------------------------------------------------------------!
 
-    USE arrays_3d
-    USE averaging
-    USE cloud_parameters
+    USE arrays_3d,                                                             &
+        ONLY:  inflow_damping_factor, lad, mean_inflow_profiles, pt_init,      &
+               q_init, ref_state, sa_init, u_init, ug, v_init, vg
+    
+    USE cloud_parameters,                                                      &
+        ONLY:  c_sedimentation, curvature_solution_effects,                    &
+               limiter_sedimentation, nc_const, ventilation_effect
+    
     USE control_parameters
-    USE grid_variables
-    USE indices
-    USE model_1d
-    USE netcdf_control
-    USE particle_attributes
+    
+    USE grid_variables,                                                        &
+        ONLY:  dx, dy
+    
+    USE indices,                                                               &
+        ONLY:  nz, nx, ny
+    
+    USE model_1d,                                                              &
+        ONLY:  damp_level_1d, dt_pr_1d, dt_run_control_1d, end_time_1d
+    
+    USE netcdf_control,                                                        &
+        ONLY:  output_for_t0
+    
+    USE particle_attributes,                                                   &
+        ONLY:  time_sort_particles
+    
     USE pegrid
-    USE profil_parameter
-    USE statistics
-
+    
+    USE statistics,                                                            &
+        ONLY:  statistic_regions, hom, hom_sum, u_max, u_max_ijk, v_max,       &
+               v_max_ijk, w_max, w_max_ijk
+    
     IMPLICIT NONE
 
-    CHARACTER (LEN=10) ::  binary_version
+    CHARACTER (LEN=10) ::  binary_version   !: 
 
 
