Index: /palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- /palm/trunk/SOURCE/init_3d_model.f90	(revision 2994)
+++ /palm/trunk/SOURCE/init_3d_model.f90	(revision 2995)
@@ -25,4 +25,9 @@
 ! -----------------
 ! $Id$
+! CALL radiation_control is not necessary during initialization because 
+! calculation of radiative fluxes at model start is done in radiation_init 
+! in any case 
+! 
+! 2977 2018-04-17 10:27:57Z kanani
 ! Implement changes from branch radiation (r2948-2971) with minor modifications
 ! (moh.hefny):
@@ -514,5 +519,5 @@
     USE radiation_model_mod,                                                   &
         ONLY:  average_radiation,                                              &
-               radiation_init, radiation, radiation_control, radiation_scheme, &
+               radiation_init, radiation, radiation_scheme,                    &
                radiation_calc_svf, radiation_write_svf,                        &
                radiation_interaction, radiation_interactions,                  &
@@ -2435,10 +2440,9 @@
 !--    Adjust radiative fluxes. In case of urban and land surfaces, also 
 !--    call an initial interaction.
-       CALL radiation_control 
        IF ( radiation_interactions )  THEN
           CALL radiation_interaction
        ENDIF
     ENDIF
-    
+
 !
 !-- Temporary solution to add LSM and radiation time series to the default
Index: /palm/trunk/SOURCE/parin.f90
===================================================================
--- /palm/trunk/SOURCE/parin.f90	(revision 2994)
+++ /palm/trunk/SOURCE/parin.f90	(revision 2995)
@@ -25,4 +25,9 @@
 ! -----------------
 ! $Id$
+! time_since_reference_point must be calculated/initialized before the first  
+! call of functions related to the radiation model which occur in 
+! time_integration_spinup or time_integration
+! 
+! 2980 2018-04-17 15:19:27Z suehring
 ! Revise message call
 ! 
@@ -864,4 +869,5 @@
              IF ( spinup_time > 0.0_wp )  THEN
                 coupling_start_time = spinup_time
+                time_since_reference_point = simulated_time - coupling_start_time
                 IF ( spinup_pt_mean == 9999999.9_wp )  THEN
                    spinup_pt_mean = pt_surface
Index: /palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- /palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2994)
+++ /palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2995)
@@ -28,4 +28,11 @@
 ! -----------------
 ! $Id$
+! IF-statement in radiation_init removed so that the calculation of radiative 
+! fluxes at model start is done in any case, bugfix in 
+! radiation_presimulate_solar_pos (end_time is the sum of end_time and the 
+! spinup_time specified in the p3d_file ), list of variables/fields that have
+! to be written out or read in case of restarts has been extended
+! 
+! 2977 2018-04-17 10:27:57Z kanani
 ! Implement changes from branch radiation (r2948-2971) with minor modifications,
 ! plus some formatting.
@@ -2162,17 +2169,18 @@
 !
 !--    Calculate radiative fluxes at model start
-       IF (  TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
-
-          SELECT CASE ( radiation_scheme )
-             CASE ( 'rrtmg' )
-                CALL radiation_rrtmg
-             CASE ( 'clear-sky' )
-                CALL radiation_clearsky
-             CASE ( 'constant' )
-                CALL radiation_constant
-             CASE DEFAULT
-          END SELECT
-
-       ENDIF
+       SELECT CASE ( TRIM( radiation_scheme ) )
+
+          CASE ( 'rrtmg' )
+             CALL radiation_rrtmg
+
+          CASE ( 'clear-sky' )
+             CALL radiation_clearsky
+
+          CASE ( 'constant' )
+             CALL radiation_constant
+
+          CASE DEFAULT
+
+       END SELECT
 
        RETURN
@@ -2209,4 +2217,5 @@
 !--    Calculate sky transmissivity
        sky_trans = 0.6_wp + 0.2_wp * zenith(0)
+
 !
 !--    Calculate value of the Exner function at model surface
@@ -2302,5 +2311,6 @@
                    exn1 = (hyp(k) / 100000.0_wp )**0.286_wp
 
-                   surf%rad_sw_in(m)  = solar_constant * sky_trans * zenith(0)
+                   surf%rad_sw_in(m) = solar_constant * sky_trans * zenith(0)
+
 !
 !--                Weighted average according to surface fraction. 
@@ -2361,5 +2371,5 @@
                 rad_lw_out(0,j,i) = surf%rad_lw_out(m)
              ENDDO
-
+ 
           END SUBROUTINE radiation_clearsky_surf
 
@@ -6593,5 +6603,5 @@
 !
 !--   Process simulation time
-      DO  it = 0, CEILING(end_time / dt_radiation)
+      DO  it = 0, CEILING(( end_time - spinup_time ) / dt_radiation)
          time_since_reference_point = REAL(it, wp) * dt_radiation
          CALL simulate_pos
@@ -6604,4 +6614,5 @@
       dsidir(:,:) = dsidir_tmp(:, 1:ndsidir)
       DEALLOCATE ( dsidir_tmp )
+
       ALLOCATE ( dsitrans(nsurfl, ndsidir) )
       ALLOCATE ( dsitransc(npcbl, ndsidir) )
@@ -6752,5 +6763,5 @@
               
  !--             read nsvfl, ncsfl
-              READ ( fsvf ) nsvfl, ncsfl, nsurfl_from_file
+              READ ( fsvf ) nsvfl, ncsfl, nsurfl_from_file, npcbl, ndsidir
               IF ( nsvfl < 0  .OR.  ncsfl < 0 )  THEN
                   WRITE( message_string, * ) 'Wrong number of SVF or CSF'
@@ -6772,6 +6783,11 @@
                  READ(fsvf) skyvf
                  READ(fsvf) skyvft
+                 READ(fsvf) dsitrans  
               ENDIF
-                
+              
+              IF ( plant_canopy  .AND.  npcbl > 0 ) THEN
+                 READ ( fsvf )  dsitransc
+              ENDIF
+   
               IF ( nsvfl > 0 )  THEN
                  IF ( .NOT. ALLOCATED( svf ) )      ALLOCATE( svf(ndsvf,nsvfl) )
@@ -6825,8 +6841,12 @@
 
                 WRITE ( fsvf )  rad_version
-                WRITE ( fsvf )  nsvfl, ncsfl, nsurfl
+                WRITE ( fsvf )  nsvfl, ncsfl, nsurfl, npcbl, ndsidir
                 IF ( nsurfl > 0 ) THEN
                    WRITE ( fsvf )  skyvf
                    WRITE ( fsvf )  skyvft
+                   WRITE ( fsvf )  dsitrans
+                ENDIF
+                IF ( npcbl > 0 ) THEN
+                   WRITE ( fsvf )  dsitransc
                 ENDIF
                 IF ( nsvfl > 0 ) THEN
