Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 3646)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 3647)
@@ -15,5 +15,5 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 1997-2018 Leibniz Universitaet Hannover
+! Copyright 1997-2019 Leibniz Universitaet Hannover
 !------------------------------------------------------------------------------!
 !
@@ -25,4 +25,9 @@
 ! -----------------
 ! $Id$
+! Bugfix: add time_since_reference_point to IF clause for data_output calls
+! (otherwise skip_time_* values don't come into affect with dt_do* = 0.0).
+! Clean up indoor_model and biometeorology model call.
+! 
+! 3646 2018-12-28 17:58:49Z kanani
 ! Bugfix: use time_since_reference_point instead of simulated_time where
 ! required (relevant when using wall/soil spinup)
@@ -1401,7 +1406,5 @@
 !--    through wall, etc.
 !--    dt_indoor steers the frequency of the indoor model calculations
-       IF (       indoor_model                                                    &
-            .AND. intermediate_timestep_count == intermediate_timestep_count_max  &
-            .AND. time_since_reference_point > skip_time_do_indoor )  THEN
+       IF ( indoor_model )  THEN
 
           time_indoor = time_indoor + dt_3d
@@ -1503,5 +1506,13 @@
 !
 !--    Biometeorology calculation of stationary thermal indices
-       IF ( biometeorology  .AND.  time_do3d >= dt_do3d )  THEN
+!--    Todo (kanani): biometeorology needs own time_... treatment.
+!--                   It might be that time_do2d_xy differs from time_do3d,
+!--                   and then we might get trouble with the biomet output,
+!--                   because we can have 2d and/or 3d biomet output!!
+       IF (         biometeorology  &
+             .AND.  ( ( time_do3d >= dt_do3d  .AND.  time_since_reference_point >= skip_time_do3d )          &
+                      .OR.                                                                                   &
+                      ( time_do2d_xy >= dt_do2d_xy  .AND.  time_since_reference_point >= skip_time_do2d_xy ) &
+                    ) )  THEN
 !
 !--       If required, do thermal comfort calculations
@@ -1569,6 +1580,6 @@
 !--    Sum-up 3d-arrays for later output of time-averaged 2d/3d/masked data
        IF ( averaging_interval /= 0.0_wp  .AND.                                &
-            ( dt_data_output_av - time_do_av ) <= averaging_interval  .AND. &
-            time_since_reference_point >= skip_time_data_output_av )                    &
+            ( dt_data_output_av - time_do_av ) <= averaging_interval  .AND.    &
+            time_since_reference_point >= skip_time_data_output_av )           &
        THEN
           time_do_sla = time_do_sla + dt_3d
@@ -1582,7 +1593,7 @@
 !--    Average surface data
        IF ( surface_data_output )  THEN
-          IF ( averaging_interval_surf /= 0.0_wp  .AND.                        & 
-               ( dt_dosurf_av - time_dosurf_av ) <= averaging_interval_surf    &
-          .AND.  time_since_reference_point >= skip_time_dosurf_av )  THEN
+          IF (         averaging_interval_surf /= 0.0_wp                               &
+                .AND.  ( dt_dosurf_av - time_dosurf_av ) <= averaging_interval_surf    &
+                .AND.  time_since_reference_point >= skip_time_dosurf_av )  THEN
              IF ( time_dosurf_av >= dt_averaging_input )  THEN        
                 CALL surface_output_averaging
@@ -1626,5 +1637,6 @@
 !
 !--    Graphic output for PROFIL
-       IF ( time_dopr >= dt_dopr )  THEN
+       IF (        time_dopr >= dt_dopr                                     &
+            .AND.  time_since_reference_point >= skip_time_dopr )  THEN
           IF ( dopr_n /= 0 )  CALL data_output_profiles
           time_dopr = MOD( time_dopr, MAX( dt_dopr, dt_3d ) )
@@ -1642,5 +1654,6 @@
 !--    Output of spectra (formatted for use with PROFIL), in case of no
 !--    time averaging, spectra has to be calculated before
-       IF ( time_dosp >= dt_dosp )  THEN
+       IF (         time_dosp >= dt_dosp                                     &
+             .AND.  time_since_reference_point >= skip_time_dosp )  THEN
           IF ( average_count_sp == 0 )  CALL calc_spectra
           CALL data_output_spectra
@@ -1650,13 +1663,16 @@
 !
 !--    2d-data output (cross-sections)
-       IF ( time_do2d_xy >= dt_do2d_xy )  THEN
+       IF (         time_do2d_xy >= dt_do2d_xy                               &
+             .AND.  time_since_reference_point >= skip_time_do2d_xy )  THEN
           CALL data_output_2d( 'xy', 0 )
           time_do2d_xy = MOD( time_do2d_xy, MAX( dt_do2d_xy, dt_3d ) )
        ENDIF
-       IF ( time_do2d_xz >= dt_do2d_xz )  THEN
+       IF (         time_do2d_xz >= dt_do2d_xz                               &
+             .AND.  time_since_reference_point >= skip_time_do2d_xz )  THEN
           CALL data_output_2d( 'xz', 0 )
           time_do2d_xz = MOD( time_do2d_xz, MAX( dt_do2d_xz, dt_3d ) )
        ENDIF
-       IF ( time_do2d_yz >= dt_do2d_yz )  THEN
+       IF (         time_do2d_yz >= dt_do2d_yz                               &
+             .AND.  time_since_reference_point >= skip_time_do2d_yz )  THEN
           CALL data_output_2d( 'yz', 0 )
           time_do2d_yz = MOD( time_do2d_yz, MAX( dt_do2d_yz, dt_3d ) )
@@ -1665,5 +1681,6 @@
 !
 !--    3d-data output (volume data)
-       IF ( time_do3d >= dt_do3d )  THEN
+       IF (         time_do3d >= dt_do3d                                     & 
+             .AND.  time_since_reference_point >= skip_time_do3d )  THEN
           CALL data_output_3d( 0 )
           time_do3d = MOD( time_do3d, MAX( dt_do3d, dt_3d ) )
@@ -1673,7 +1690,8 @@
 !--    Masked data output
        DO  mid = 1, masks
-          IF ( time_domask(mid) >= dt_domask(mid) )  THEN
+          IF (         time_domask(mid) >= dt_domask(mid)                          &
+                .AND.  time_since_reference_point >= skip_time_domask(mid) )  THEN
              CALL data_output_mask( 0 )
-             time_domask(mid) = MOD( time_domask(mid),  &
+             time_domask(mid) = MOD( time_domask(mid),                             &
                                      MAX( dt_domask(mid), dt_3d ) )
           ENDIF
@@ -1682,5 +1700,6 @@
 !
 !--    Output of time-averaged 2d/3d/masked data
-       IF ( time_do_av >= dt_data_output_av )  THEN
+       IF (         time_do_av >= dt_data_output_av                                &
+             .AND.  time_since_reference_point >= skip_time_data_output_av )  THEN
           CALL average_3d_data
           CALL data_output_2d( 'xy', 1 )
@@ -1696,9 +1715,11 @@
 !--    Output of surface data, instantaneous and averaged data
        IF ( surface_data_output )  THEN
-          IF ( time_dosurf >= dt_dosurf )  THEN
+          IF (         time_dosurf >= dt_dosurf                                    &
+                .AND.  time_since_reference_point >= skip_time_dosurf )  THEN
              CALL surface_output( 0 )
              time_dosurf = MOD( time_dosurf, MAX( dt_dosurf, dt_3d ) )
           ENDIF
-          IF ( time_dosurf_av >= dt_dosurf_av )  THEN
+          IF (         time_dosurf_av >= dt_dosurf_av                              &
+                .AND.  time_since_reference_point >= skip_time_dosurf_av )  THEN
              CALL surface_output( 1 )
              time_dosurf_av = MOD( time_dosurf_av, MAX( dt_dosurf_av, dt_3d ) )
@@ -1709,5 +1730,5 @@
 !--    Output of particle time series
        IF ( particle_advection )  THEN
-          IF ( time_dopts >= dt_dopts  .OR. &
+          IF ( time_dopts >= dt_dopts  .OR.                                    &
                ( time_since_reference_point >= particle_advection_start  .AND. &
                  first_call_lpm ) )  THEN
