Index: palm/trunk/SOURCE/Makefile
===================================================================
--- palm/trunk/SOURCE/Makefile	(revision 2932)
+++ palm/trunk/SOURCE/Makefile	(revision 2934)
@@ -25,4 +25,7 @@
 # -----------------
 # $Id$
+# Added dependencies for parent and child synchronization
+# 
+# 2921 2018-03-22 15:05:23Z Giersch
 # date_and_time_mod dependency has been added to read/write_restart_data_mod
 # 
@@ -939,4 +942,5 @@
 	netcdf_interface_mod.o \
 	plant_canopy_model_mod.o \
+	pmc_interface_mod.o \
 	radiation_model_mod.o \
 	random_function_mod.o \
@@ -1472,4 +1476,5 @@
 	mod_kinds.o \
 	modules.o \
+	pmc_interface_mod.o \
 	radiation_model_mod.o \
 	surface_layer_fluxes_mod.o \
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 2932)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 2934)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! Check spinup in case of nested runs, spinup time and timestep must be 
+! identical to assure synchronuous simulations. 
+! 
+! 2932 2018-03-26 09:39:22Z maronga
 ! renamed particles_par to particle_parameters
 ! 
@@ -703,7 +707,9 @@
     LOGICAL     ::  found                            !<
 
+    REAL(wp)    ::  dt_spinup_max                    !< maximum spinup timestep in nested domains
     REAL(wp)    ::  dum                              !<
     REAL(wp)    ::  gradient                         !<
     REAL(wp)    ::  remote = 0.0_wp                  !<
+    REAL(wp)    ::  spinup_time_max                  !< maximum spinup time in nested domains
     REAL(wp)    ::  time_to_be_simulated_from_reference_point  !<
 
@@ -1397,4 +1403,23 @@
 #endif
     ENDIF
+!
+!-- In case of spinup and nested run, spinup end time must be identical 
+!-- in order to have synchronously running simulations. 
+    IF ( nested_run  .AND.  spinup )  THEN
+#if defined( __parallel )
+       CALL MPI_ALLREDUCE( spinup_time, spinup_time_max, 1, MPI_REAL,          &
+                           MPI_MAX, MPI_COMM_WORLD, ierr )
+       CALL MPI_ALLREDUCE( dt_spinup,   dt_spinup_max,   1, MPI_REAL,          &
+                           MPI_MAX, MPI_COMM_WORLD, ierr )
+
+       IF ( spinup_time /= spinup_time_max  .OR.  dt_spinup /= dt_spinup_max ) &
+       THEN
+          message_string = 'In case of nesting, spinup_time and ' //           &
+                           'dt_spinup must be identical in all parent ' //     &
+                           'and child domains.'
+          CALL message( 'check_parameters', 'PA0489', 3, 2, 0, 6, 0 )
+       ENDIF
+#endif
+    ENDIF
 
     IF ( cloud_physics  .AND.  .NOT.  humidity )  THEN
Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 2932)
+++ palm/trunk/SOURCE/init_3d_model.f90	(revision 2934)
@@ -25,4 +25,9 @@
 ! -----------------
 ! $Id$
+! Synchronize parent and child models after initialization.
+! Remove obsolete masking of topography grid points for Runge-Kutta weighted
+! tendency arrays.
+! 
+! 2920 2018-03-22 11:22:01Z kanani
 ! Add call for precalculating apparent solar positions (moh.hefny)
 ! 
@@ -492,4 +497,7 @@
     USE plant_canopy_model_mod,                                                &
         ONLY:  pcm_init
+
+    USE pmc_interface,                                                         &
+        ONLY:  nested_run
 
     USE radiation_model_mod,                                                   &
@@ -1832,12 +1840,4 @@
                    w(k,j,i)     = MERGE( w(k,j,i), 0.0_wp,                     &
                                          BTEST( wall_flags_0(k,j,i), 3 ) )
-                   tu_m(k,j,i)  = MERGE( tu_m(k,j,i), 0.0_wp,                  &
-                                         BTEST( wall_flags_0(k,j,i), 1 ) )
-                   tv_m(k,j,i)  = MERGE( tv_m(k,j,i), 0.0_wp,                  &
-                                         BTEST( wall_flags_0(k,j,i), 2 ) )
-                   tw_m(k,j,i)  = MERGE( tw_m(k,j,i), 0.0_wp,                  &
-                                         BTEST( wall_flags_0(k,j,i), 3 ) )
-                   tpt_m(k,j,i) = MERGE( tpt_m(k,j,i), 0.0_wp,                 &
-                                         BTEST( wall_flags_0(k,j,i), 0 ) )
                 ENDDO
              ENDDO
@@ -2565,4 +2565,11 @@
 !-- after call of user_init!
     CALL close_file( 13 )
+!
+!-- In case of nesting, put an barrier to assure that all parent and child 
+!-- domains finished initialization. 
+#if defined( __parallel )
+    IF ( nested_run )  CALL MPI_BARRIER( MPI_COMM_WORLD, ierr )
+#endif
+
 
     CALL location_message( 'leaving init_3d_model', .TRUE. )
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 2932)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 2934)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Little formatting adjustment.
+! 
+! 2817 2018-02-19 16:32:21Z knoop
 ! Preliminary gust module interface implemented
 ! 
@@ -481,5 +484,4 @@
 !-- At beginning determine the first time step
     CALL timestep
-
 !
 !-- Synchronize the timestep in case of nested run.
@@ -497,5 +499,4 @@
     IF ( simulated_time == 0.0_wp )  CALL flow_statistics
     CALL run_control
-
 !
 !-- Data exchange between coupled models in case that a call has been omitted 
@@ -819,7 +820,7 @@
 !
 !--       Impose a turbulent inflow using synthetic generated turbulence
-         IF ( use_syn_turb_gen ) THEN 
-            CALL  stg_main
-         ENDIF
+          IF ( use_syn_turb_gen ) THEN 
+             CALL  stg_main
+          ENDIF
 
 !
Index: palm/trunk/SOURCE/time_integration_spinup.f90
===================================================================
--- palm/trunk/SOURCE/time_integration_spinup.f90	(revision 2932)
+++ palm/trunk/SOURCE/time_integration_spinup.f90	(revision 2934)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Synchronize parent and child models after spinup.
+! 
+! 2881 2018-03-13 16:24:40Z maronga
 ! Added flag for switching on/off calculation of soil moisture
 ! 
@@ -117,6 +120,8 @@
         ONLY:  lsm_energy_balance, lsm_soil_model, lsm_swap_timelevel
 
-    USE pegrid,                                                                &
-        ONLY:  myid
+    USE pegrid
+
+    USE pmc_interface,                                                         &
+        ONLY:  nested_run
 
     USE kinds
@@ -551,4 +556,8 @@
     DEALLOCATE(v_save)
 
+#if defined( __parallel )
+    IF ( nested_run )  CALL MPI_BARRIER( MPI_COMM_WORLD, ierr )
+#endif
+
     CALL location_message( 'finished spinup-sequence', .TRUE. )
 
