Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 364)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 366)
@@ -1,4 +1,8 @@
 New:
 ---
+bc_lr/bc_ns  in most subroutines replaced by LOGICAL variables bc_lr_cyc,
+bc_ns_cyc for speed optimization
+(check_parameters, diffusion_u, diffusion_v, diffusion_w, modules)
+
 Additional timestep criterion in case of simulations with plant canopy (timestep)
 
@@ -113,4 +117,7 @@
 Errors:
 ------
+Bugfix: Output on unit 14 only if requested by write_binary.
+(user_last_actions)
+
 Bugfix to avoid zero division by km_neutral (production_e)
 
@@ -165,3 +172,3 @@
 Bugfix: initial setting of time_coupling in coupled restart runs (time_integration)
 
-advec_particles, check_parameters, cpu_log, data_output_2d, data_output_3d, header, init_3d_model, init_particles, modules, netcdf, prandtl_fluxes, production_e, read_var_list, time_integration, write_var_list
+advec_particles, check_parameters, cpu_log, data_output_2d, data_output_3d, header, init_3d_model, init_particles, modules, netcdf, prandtl_fluxes, production_e, read_var_list, time_integration, user_last_actions, write_var_list
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 364)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 366)
@@ -4,4 +4,5 @@
 ! Actual revisions:
 ! -----------------
+! 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
@@ -1105,4 +1106,9 @@
 
 !
+!-- Internal variables used for speed optimization in if clauses
+    IF ( bc_lr /= 'cyclic' )  bc_lr_cyc = .FALSE.
+    IF ( bc_ns /= 'cyclic' )  bc_ns_cyc = .FALSE.
+
+!
 !-- Non-cyclic lateral boundaries require the multigrid method and Piascek-
 !-- Willimas advection scheme. Several schemes and tools do not work with
Index: palm/trunk/SOURCE/diffusion_u.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_u.f90	(revision 364)
+++ palm/trunk/SOURCE/diffusion_u.f90	(revision 366)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! bc_ns replaced by bc_ns_cyc
 !
 ! Former revisions:
@@ -101,5 +101,5 @@
 !--             velocity components parallel to the outflow boundary in
 !--             the direction normal to the outflow boundary.
-                IF ( bc_ns /= 'cyclic' )  THEN
+                IF ( .NOT. bc_ns_cyc )  THEN
                    kmyp_y = MAX( kmyp_y, km_damp_y(j) )
                    kmym_y = MAX( kmym_y, km_damp_y(j) )
@@ -134,5 +134,5 @@
 !--                velocity components parallel to the outflow boundary in
 !--                the direction normal to the outflow boundary.
-                   IF ( bc_ns /= 'cyclic' )  THEN
+                   IF ( .NOT. bc_ns_cyc )  THEN
                       kmyp_y = MAX( kmyp_y, km_damp_y(j) )
                       kmym_y = MAX( kmym_y, km_damp_y(j) )
@@ -266,5 +266,5 @@
 !--       parallel to the outflow boundary in the direction normal to the
 !--       outflow boundary.
-          IF ( bc_ns /= 'cyclic' )  THEN
+          IF ( .NOT. bc_ns_cyc )  THEN
              kmyp_y = MAX( kmyp_y, km_damp_y(j) )
              kmym_y = MAX( kmym_y, km_damp_y(j) )
@@ -302,5 +302,5 @@
 !--          velocity components parallel to the outflow boundary in
 !--          the direction normal to the outflow boundary.
-             IF ( bc_ns /= 'cyclic' )  THEN
+             IF ( .NOT. bc_ns_cyc )  THEN
                 kmyp_y = MAX( kmyp_y, km_damp_y(j) )
                 kmym_y = MAX( kmym_y, km_damp_y(j) )
Index: palm/trunk/SOURCE/diffusion_v.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_v.f90	(revision 364)
+++ palm/trunk/SOURCE/diffusion_v.f90	(revision 366)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! bc_lr replaced by bc_lr_cyc
 !
 ! Former revisions:
@@ -99,5 +99,5 @@
 !--             velocity components parallel to the outflow boundary in
 !--             the direction normal to the outflow boundary.
-                IF ( bc_lr /= 'cyclic' )  THEN
+                IF ( .NOT. bc_lr_cyc )  THEN
                    kmxp_x = MAX( kmxp_x, km_damp_x(i) )
                    kmxm_x = MAX( kmxm_x, km_damp_x(i) )
@@ -132,5 +132,5 @@
 !--                velocity components parallel to the outflow boundary in
 !--                the direction normal to the outflow boundary.
-                   IF ( bc_lr /= 'cyclic' )  THEN
+                   IF ( .NOT. bc_lr_cyc )  THEN
                       kmxp_x = MAX( kmxp_x, km_damp_x(i) )
                       kmxm_x = MAX( kmxm_x, km_damp_x(i) )
@@ -263,5 +263,5 @@
 !--       parallel to the outflow boundary in the direction normal to the
 !--       outflow boundary.
-          IF ( bc_lr /= 'cyclic' )  THEN
+          IF ( .NOT. bc_lr_cyc )  THEN
              kmxp_x = MAX( kmxp_x, km_damp_x(i) )
              kmxm_x = MAX( kmxm_x, km_damp_x(i) )
@@ -301,5 +301,5 @@
 !--          velocity components parallel to the outflow boundary in
 !--          the direction normal to the outflow boundary.
-             IF ( bc_lr /= 'cyclic' )  THEN
+             IF ( .NOT. bc_lr_cyc )  THEN
                 kmxp_x = MAX( kmxp_x, km_damp_x(i) )
                 kmxm_x = MAX( kmxm_x, km_damp_x(i) )
Index: palm/trunk/SOURCE/diffusion_w.f90
===================================================================
--- palm/trunk/SOURCE/diffusion_w.f90	(revision 364)
+++ palm/trunk/SOURCE/diffusion_w.f90	(revision 366)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! bc_lr/bc_ns replaced by bc_lr_cyc/bc_ns_cyc
 !
 ! Former revisions:
@@ -100,9 +100,9 @@
 !--             velocity components parallel to the outflow boundary in
 !--             the direction normal to the outflow boundary.
-                IF ( bc_lr /= 'cyclic' )  THEN
+                IF ( .NOT. bc_lr_cyc )  THEN
                    kmxp_x = MAX( kmxp_x, km_damp_x(i) )
                    kmxm_x = MAX( kmxm_x, km_damp_x(i) )
                 ENDIF
-                IF ( bc_ns /= 'cyclic' )  THEN
+                IF ( .NOT. bc_ns_cyc )  THEN
                    kmyp_y = MAX( kmyp_y, km_damp_y(j) )
                    kmym_y = MAX( kmym_y, km_damp_y(j) )
@@ -150,9 +150,9 @@
 !--                velocity components parallel to the outflow boundary in
 !--                the direction normal to the outflow boundary.
-                   IF ( bc_lr /= 'cyclic' )  THEN
+                   IF ( .NOT. bc_lr_cyc )  THEN
                       kmxp_x = MAX( kmxp_x, km_damp_x(i) )
                       kmxm_x = MAX( kmxm_x, km_damp_x(i) )
                    ENDIF
-                   IF ( bc_ns /= 'cyclic' )  THEN
+                   IF ( .NOT. bc_ns_cyc )  THEN
                       kmyp_y = MAX( kmyp_y, km_damp_y(j) )
                       kmym_y = MAX( kmym_y, km_damp_y(j) )
@@ -231,9 +231,9 @@
 !--       parallel to the outflow boundary in the direction normal to the
 !--       outflow boundary.
-          IF ( bc_lr /= 'cyclic' )  THEN
+          IF ( .NOT. bc_lr_cyc )  THEN
              kmxp_x = MAX( kmxp_x, km_damp_x(i) )
              kmxm_x = MAX( kmxm_x, km_damp_x(i) )
           ENDIF
-          IF ( bc_ns /= 'cyclic' )  THEN
+          IF ( .NOT. bc_ns_cyc )  THEN
              kmyp_y = MAX( kmyp_y, km_damp_y(j) )
              kmym_y = MAX( kmym_y, km_damp_y(j) )
@@ -293,9 +293,9 @@
 !--          velocity components parallel to the outflow boundary in
 !--          the direction normal to the outflow boundary.
-             IF ( bc_lr /= 'cyclic' )  THEN
+             IF ( .NOT. bc_lr_cyc )  THEN
                 kmxp_x = MAX( kmxp_x, km_damp_x(i) )
                 kmxm_x = MAX( kmxm_x, km_damp_x(i) )
              ENDIF
-             IF ( bc_ns /= 'cyclic' )  THEN
+             IF ( .NOT. bc_ns_cyc )  THEN
                 kmyp_y = MAX( kmyp_y, km_damp_y(j) )
                 kmym_y = MAX( kmym_y, km_damp_y(j) )
Index: palm/trunk/SOURCE/init_ocean.f90
===================================================================
--- palm/trunk/SOURCE/init_ocean.f90	(revision 364)
+++ palm/trunk/SOURCE/init_ocean.f90	(revision 366)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Bugfix: First calculation of hyp(0) changed
 !
 ! Former revisions:
@@ -50,7 +50,8 @@
     rho_init(nzt) = rho_surface
 
-    DO  k = nzt-1, 0, -1
+    DO  k = nzt-1, 1, -1
        hyp(k) = hyp(k+1) + rho_surface * g * dzu(k)
     ENDDO
+    hyp(0) = hyp(1) + rho_surface * g * dzu(1)
 
     IF ( myid == 0 )  THEN
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 364)
+++ palm/trunk/SOURCE/modules.f90	(revision 366)
@@ -5,4 +5,5 @@
 ! Current revisions:
 ! -----------------
+! +bc_lr_cyc, bc_ns_cyc
 ! +output_for_t0 
 ! translation error of actual -> current revisions fixed
@@ -358,4 +359,5 @@
 
     LOGICAL ::  adjust_mixing_length = .FALSE., avs_output = .FALSE., &
+                bc_lr_cyc =.TRUE., bc_ns_cyc = .TRUE., &
                 call_psolver_at_all_substeps = .TRUE., &
                 cloud_droplets = .FALSE., cloud_physics = .FALSE., &
Index: palm/trunk/SOURCE/user_last_actions.f90
===================================================================
--- palm/trunk/SOURCE/user_last_actions.f90	(revision 364)
+++ palm/trunk/SOURCE/user_last_actions.f90	(revision 366)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Output on unit 14 only if requested by write_binary
 !
 ! Former revisions:
@@ -18,4 +18,5 @@
 !------------------------------------------------------------------------------!
 
+    USE control_parameters
     USE user
 
@@ -25,9 +26,12 @@
 !-- Here the user-defined actions at the end of a job follow.
 !-- Sample for user-defined output:
-!    IF ( ALLOCATED( u2_av ) )  THEN
-!       WRITE ( 14 )  'u2_av               ';  WRITE ( 14 )  u2_av
-!    ENDIF
+    IF ( write_binary(1:4) == 'true' )  THEN
+!       IF ( ALLOCATED( u2_av ) )  THEN
+!          WRITE ( 14 )  'u2_av               ';  WRITE ( 14 )  u2_av
+!       ENDIF
 
-    WRITE ( 14 )  '*** end user ***    '
+       WRITE ( 14 )  '*** end user ***    '
+
+    ENDIF
 
  END SUBROUTINE user_last_actions
