Index: palm/trunk/SOURCE/model_1d_mod.f90
===================================================================
--- palm/trunk/SOURCE/model_1d_mod.f90	(revision 4448)
+++ palm/trunk/SOURCE/model_1d_mod.f90	(revision 4449)
@@ -25,6 +25,10 @@
 ! -----------------
 ! $Id$
+! Set intermediate_timestep_count back to zero after 1D-model integration.
+! This is required e.g. for initial calls of calc_mean_profile.
+!
+! 4360 2020-01-07 11:25:50Z suehring
 ! Corrected "Former revisions" section
-! 
+!
 ! 3655 2019-01-07 16:51:22Z knoop
 ! Modularization of all bulk cloud physics code components
@@ -37,5 +41,5 @@
 ! ------------
 !> 1D-model to initialize the 3D-arrays.
-!> The temperature profile is set as steady and a corresponding steady solution 
+!> The temperature profile is set as steady and a corresponding steady solution
 !> of the wind profile is being computed.
 !> All subroutines required can be found within this file.
@@ -55,5 +59,5 @@
     USE basic_constants_and_equations_mod,                                     &
         ONLY:  g, kappa, pi
-    
+
     USE control_parameters,                                                    &
         ONLY:  constant_diffusion, constant_flux_layer, dissipation_1d, f,     &
@@ -66,10 +70,10 @@
     USE indices,                                                               &
         ONLY:  nzb, nzb_diff, nzt
-    
+
     USE kinds
 
     USE pegrid,                                                                &
         ONLY:  myid
-        
+
 
     IMPLICIT NONE
@@ -177,5 +181,5 @@
 
  SUBROUTINE init_1d_model
- 
+
     USE grid_variables,                                                        &
         ONLY:  dx, dy
@@ -273,5 +277,5 @@
     vsws1d = 0.0_wp
     z01d  = roughness_length
-    z0h1d = z0h_factor * z01d 
+    z0h1d = z0h_factor * z01d
     IF ( humidity )  qs1d = 0.0_wp
 
@@ -308,5 +312,5 @@
 !> Runge-Kutta time differencing scheme for the 1D-model.
 !------------------------------------------------------------------------------!
- 
+
  SUBROUTINE time_integration_1d
 
@@ -350,5 +354,5 @@
 
 !
-!--       Compute all tendency terms. If a constant-flux layer is simulated, 
+!--       Compute all tendency terms. If a constant-flux layer is simulated,
 !--       k starts at nzb+2.
           DO  k = nzb_diff, nzt
@@ -438,6 +442,6 @@
 !
 !--       Tendency terms at the top of the constant-flux layer.
-!--       Finite differences of the momentum fluxes are computed using half the 
-!--       normal grid length (2.0*ddzw(k)) for the sake of enhanced accuracy 
+!--       Finite differences of the momentum fluxes are computed using half the
+!--       normal grid length (2.0*ddzw(k)) for the sake of enhanced accuracy
           IF ( constant_flux_layer )  THEN
 
@@ -574,5 +578,5 @@
 !
 !--       Boundary conditions for the prognostic variables.
-!--       At the top boundary (nzt+1) u, v, e, and diss keep their initial 
+!--       At the top boundary (nzt+1) u, v, e, and diss keep their initial
 !--       values (ug(nzt+1), vg(nzt+1), 0, 0).
 !--       At the bottom boundary, Dirichlet condition is used for u and v (0)
@@ -627,5 +631,5 @@
 !
 !--          Compute the Richardson-flux numbers,
-!--          first at the top of the constant-flux layer using u* of the 
+!--          first at the top of the constant-flux layer using u* of the
 !--          previous time step (+1E-30, if u* = 0), then in the remaining area.
 !--          There the rif-numbers of the previous time step are used.
@@ -707,5 +711,5 @@
 
 !
-!--             Boundary condition for the turbulent kinetic energy and 
+!--             Boundary condition for the turbulent kinetic energy and
 !--             dissipation rate at the top of the constant-flux layer.
 !--             Additional Neumann condition de/dz = 0 at nzb is set to ensure
@@ -723,5 +727,5 @@
                 IF ( humidity ) THEN
 !
-!--                Compute q* 
+!--                Compute q*
                    IF ( rif1d(nzb+1) >= 0.0_wp )  THEN
 !
@@ -857,5 +861,8 @@
 
     ENDDO   ! time loop
-
+!
+!-- Set intermediate_timestep_count back to zero. This is required e.g. for
+!-- initial calls of calc_mean_profile.
+    intermediate_timestep_count = 0
 
  END SUBROUTINE time_integration_1d
@@ -867,5 +874,5 @@
 !> Compute and print out quantities for run control of the 1D model.
 !------------------------------------------------------------------------------!
- 
+
  SUBROUTINE run_control_1d
 
@@ -874,5 +881,5 @@
 
     INTEGER(iwp) ::  k     !< loop index
-    
+
     REAL(wp) ::  alpha     !< angle of wind vector at top of constant-flux layer
     REAL(wp) ::  energy    !< kinetic energy
@@ -938,5 +945,5 @@
 !> Compute the time step w.r.t. the diffusion criterion
 !------------------------------------------------------------------------------!
- 
+
  SUBROUTINE timestep_1d
 
@@ -978,5 +985,5 @@
                                   'dt_1d = ',dt_1d,' s   simulation stopped!'
        CALL message( 'timestep_1d', 'PA0192', 1, 2, 0, 6, 0 )
-       
+
     ENDIF
 
@@ -990,5 +997,5 @@
 !> List output of profiles from the 1D-model
 !------------------------------------------------------------------------------!
- 
+
  SUBROUTINE print_1d_model
 
