Index: /palm/trunk/DOC/app/chapter_4.2.html
===================================================================
--- /palm/trunk/DOC/app/chapter_4.2.html	(revision 290)
+++ /palm/trunk/DOC/app/chapter_4.2.html	(revision 291)
@@ -4802,5 +4802,5 @@
             <td style="vertical-align: top;">Height of the convective
 boundary layer (horizontal average)
-determined by the temperature profile (in m).</td>
+determined by the temperature profile, following the criterion of Sullivan et al. (1998) (in m).</td>
 
 
Index: /palm/trunk/DOC/tec/message_identifiers
===================================================================
--- /palm/trunk/DOC/tec/message_identifiers	(revision 290)
+++ /palm/trunk/DOC/tec/message_identifiers	(revision 291)
@@ -19,6 +19,7 @@
     PA0007            coupling mode "...": dt_restart = ... is not equal 
                        to dt_restart_remote = ...
-    PA0008            coupling mode "...": end_time = ... is not equal to
-                       end_time_remote = ...
+    PA0008            coupling mode "...": simulation_time_since_reference =
+                       ... is not equal to
+                       simulation_time_since_reference_remote = ...
     PA0009            coupling mode "...":  dx = ... is not equal to 
                        dx_remote = ...
@@ -577,4 +578,6 @@
     PA0315            color_interval(2) <= color_interval(1)
     PA0316            dvrpsize_interval(2) <= dvrpsize_interval(1)
+    PA0317            ocean = .F. does not allow coupling_char = ...
+                      set by mrun-option "-y"
     
 
Index: /palm/trunk/SCRIPTS/mrun
===================================================================
--- /palm/trunk/SCRIPTS/mrun	(revision 290)
+++ /palm/trunk/SCRIPTS/mrun	(revision 291)
@@ -179,4 +179,6 @@
      #                     dvr application more user friendly
      # 20/03/09 - Marcus - update of n1ge command for lctit
+     # 16/04/09 - Siggi  - new option -y for precursor (uncoupled) ocean runs
+     #                     to be followed by a coupled atmosphere-ocean run
 
  
@@ -417,5 +419,5 @@
     # SHELLSCRIPT-OPTIONEN EINLESEN UND KOMMANDO NEU ZUSAMMENSETZEN, FALLS ES
     # FUER FOLGEJOBS BENOETIGT WIRD
- while  getopts  :a:AbBc:Cd:D:Fg:G:h:H:i:IkK:m:M:n:o:Op:P:q:r:R:s:St:T:u:U:vxX:Y: option
+ while  getopts  :a:AbBc:Cd:D:Fg:G:h:H:i:IkK:m:M:n:o:Op:P:q:r:R:s:St:T:u:U:vxX:yY: option
  do
    case  $option  in
@@ -456,4 +458,5 @@
        (x)   do_trace=true;set -x; mc="$mc -x";;
        (X)   numprocs=$OPTARG; mc="$mc -X$OPTARG";;
+       (y)   ocean_file_appendix=true; mc="$mc -y";;
        (Y)   run_coupled_model=true; coupled_dist=$OPTARG; mc="$mc -Y'$OPTARG'";;
        (\?)  printf "\n  +++ unknown option $OPTARG \n"
@@ -473,5 +476,5 @@
  then
    (printf "\n  *** mrun can be called as follows:\n"
-    printf "\n      $mrun_script_name  -b -c.. -d.. -D.. -f.. -F -h.. -i.. -I -K.. -m.. -o.. -p.. -r.. -R -s.. -t.. -T.. -v -x -X.. -Y.. <modus>\n"
+    printf "\n      $mrun_script_name  -b -c.. -d.. -D.. -f.. -F -h.. -i.. -I -K.. -m.. -o.. -p.. -r.. -R -s.. -t.. -T.. -v -x -X.. -y -Y.. <modus>\n"
     printf "\n      Description of available options:\n"
     printf "\n      Option  Description                              Default-Value"
@@ -511,4 +514,7 @@
     printf "\n        -x    tracing of mrun for debug purposes       ---"
     printf "\n        -X    # of processors (on parallel machines)   1"
+    printf "\n        -y    add appendix \"_O\" to all local output"
+    printf "\n              files (ocean precursor runs followed by"
+    printf "\n              coupled atmosphere-ocean runs)           ---"
     printf "\n        -Y    run coupled model, \"#1 #2\" with" 
     printf "\n              #1 atmosphere and #2 ocean processors    \"#/2 #/2\" depending on -X"
@@ -2407,5 +2413,5 @@
        then
           printf "      compiler is called via ssh on \"bicegate\" using module \"$mpilib\" \n"
-          ssh  130.73.232.102  -l $usern  ". /usr/share/modules/init/bash; module load $mpilib; cd $TEMPDIR; make -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
+          ssh  130.73.232.103  -l $usern  ". /usr/share/modules/init/bash; module load $mpilib; cd $TEMPDIR; make -f Makefile PROG=a.out  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$fopts\"  LDFLAGS=\"$lopts\" "
           [[ ! -f a.out ]]  &&  compile_error=true
           continue   # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN
@@ -3097,5 +3103,10 @@
              if [[ $run_coupled_model = false ]]
              then
-                echo "no_coupling"  >  runfile_atmos
+                if [[ "$ocean_file_appendix" = true ]]
+                then
+                   echo "precursor_ocean"  >  runfile_atmos
+                else
+                   echo "precursor_atmos"  >  runfile_atmos
+                fi
                 printf "\n\n"
                 if [[ $host = lcsgih  ||  $host = lcsgib ]]
@@ -4098,4 +4109,5 @@
     [[ $delete_temporary_catalog = false ]]  &&  mrun_com=${mrun_com}" -B"
     [[ $node_usage != default  &&  "$(echo $node_usage | cut -c1-3)" != "sla"  &&  $node_usage != novice ]]  &&  mrun_com=${mrun_com}" -n $node_usage"
+    [[ "$ocean_file_appendix" = true ]]  &&  mrun_com=${mrun_com}" -y"
     [[ $run_coupled_model = true ]]  &&  mrun_com=${mrun_com}" -Y \"$coupled_dist\""
     if [[ $do_remote = true ]]
Index: /palm/trunk/SCRIPTS/subjob
===================================================================
--- /palm/trunk/SCRIPTS/subjob	(revision 290)
+++ /palm/trunk/SCRIPTS/subjob	(revision 291)
@@ -163,4 +163,5 @@
      (bora)                  local_addres=130.75.105.103; local_host=lcmuk;;
      (bicegate1)             local_addres=130.73.232.102; local_host=lcsgib;;
+     (bicegate2)             local_addres=130.73.232.103; local_host=lcsgib;;
      (breg*-en0|berni*-en0)  local_addres=130.73.230.10;  local_host=ibmb;;
      (breva)                 local_addres=130.75.105.98;  local_host=lcmuk;;
@@ -319,5 +320,5 @@
         (ibmy)    queue=parallel; remote_addres=165.132.26.58; submcom=/usr/lpp/LoadL/full/bin/llsubmit;;
 	(lcfimm)  remote_addres=172.20.4.2; submcom=/opt/torque/bin/qsub;;
-        (lcsgib)  queue=smallq; remote_addres=130.73.232.102; submcom=/opt/moab/bin/msub;;
+        (lcsgib)  queue=smallq; remote_addres=130.73.232.103; submcom=/opt/moab/bin/msub;;
         (lcsgih)  queue=smallq; remote_addres=130.75.4.103; submcom=/opt/moab/bin/msub;;
         (lctit)   queue=lctit; remote_addres=172.17.75.161; submcom=/n1ge/TITECH_GRID/tools/bin/n1ge;;
Index: /palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- /palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 290)
+++ /palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 291)
@@ -8,4 +8,14 @@
 and are controlled with existing parameters slicer_range_limits.
 (set_slicer_attributes_dvrp)
+
+Ocean atmosphere coupling allows to use independent precursor runs in order
+to account for different spin-up times. The time when coupling has to be
+started is given by new inipar parameter coupling_start_time. The precursor
+ocean run has to be started using new mrun option "-y" in order to add
+appendix "_O" to all output files.
+(check_for_restart, check_parameters, data_output_2d, data_output_3d,
+data_output_profiles, data_output_ptseries, data_output_spectra,
+data_output_tseries, header, init_coupling, modules, mrun,
+parin, read_var_list, surface_coupler, time_integration, write_var_list)
 
 Polygon reduction for topography and ground plate isosurface. Reduction level
@@ -22,5 +32,5 @@
 write_var_list)
 
-check_parameters, data_output_dvrp, init_dvrp, init_grid, init_3d_model, header, modules, package_parin, parin, prognostic_equations, read_var_list, user_check_parameters, user_data_output_dvrp, user_header, user_init_grid, write_var_list
+check_for_restart, check_parameters, data_output_2d, data_output_3d, data_output_dvrp, data_output_profiles, data_output_ptseries, data_output_spectra, data_output_tseries, init_coupling, init_dvrp, init_grid, init_3d_model, header, modules, mrun, package_parin, parin, prognostic_equations, read_var_list, surface_coupler, time_integration, user_check_parameters, user_data_output_dvrp, user_header, user_init_grid, write_var_list
 
 New: set_particle_attributes, set_slicer_attributes_dvrp
@@ -28,4 +38,7 @@
 Changed:
 -------
+Temperature gradient criterion for estimating the boundary layer height
+replaced by the gradient criterion of Sullivan et al. (1998). (flow_statistics)
+
 NetCDF unit attribute in timeseries output in case of statistic regions added
 (netcdf.90)
Index: /palm/trunk/SOURCE/check_for_restart.f90
===================================================================
--- /palm/trunk/SOURCE/check_for_restart.f90	(revision 290)
+++ /palm/trunk/SOURCE/check_for_restart.f90	(revision 291)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! Coupling with independent precursor runs.
 ! Output of messages replaced by message handling routine
 !
@@ -96,6 +97,7 @@
 !
 !-- Set the stop flag also, if restart is forced by user
-    IF ( time_restart /= 9999999.9  .AND.  time_restart < simulated_time ) &
-    THEN
+    IF ( time_restart /= 9999999.9  .AND.  &
+         time_restart < time_since_reference_point )  THEN
+
 !
 !--    Restart is not neccessary, if the end time of the run (given by
Index: /palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- /palm/trunk/SOURCE/check_parameters.f90	(revision 290)
+++ /palm/trunk/SOURCE/check_parameters.f90	(revision 291)
@@ -4,4 +4,5 @@
 ! Actual revisions:
 ! -----------------
+! Coupling with independent precursor runs.
 ! Check particle_color, particle_dvrpsize, color_interval, dvrpsize_interval
 ! Bugfix: pressure included for profile output
@@ -115,5 +116,6 @@
          position, prec
     LOGICAL ::  found, ldum
-    REAL    ::  gradient, maxn, maxp, remote = 0.0
+    REAL    ::  gradient, maxn, maxp, remote = 0.0, &
+                simulation_time_since_reference
 
 !
@@ -188,11 +190,14 @@
        ENDIF
 
-       CALL MPI_SEND( end_time, 1, MPI_REAL, target_id, 14, comm_inter, ierr )
+       simulation_time_since_reference = end_time - coupling_start_time
+       CALL MPI_SEND( simulation_time_since_reference, 1, MPI_REAL, target_id, &
+                      14, comm_inter, ierr )
        CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 14, comm_inter, &
                       status, ierr )
-       IF ( end_time /= remote )  THEN
+       IF ( simulation_time_since_reference /= remote )  THEN
           WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &
-                 '": end_time = ', end_time, '& is not equal to ',             &
-                 'end_time_remote = ', remote
+                 '": simulation_time_since_reference = ',                      &
+                 simulation_time_since_reference, '& is not equal to ',        &
+                 'simulation_time_since_reference_remote = ', remote
           CALL message( 'check_parameters', 'PA0008', 1, 2, 0, 6, 0 )
        ENDIF
@@ -383,4 +388,14 @@
 
 !
+!-- Check whether an (uncoupled) atmospheric run has been declared as an
+!-- ocean run (this setting is done via mrun-option -y)
+    IF ( TRIM( coupling_mode ) == 'uncoupled'  .AND.  &
+         TRIM( coupling_char ) == '_O' )  THEN
+       message_string = 'ocean = .F. does not allow coupling_char = "' // &
+                        TRIM( coupling_char ) // '" set by mrun-option "-y"'
+       CALL message( 'check_parameters', 'PA0317', 1, 2, 0, 6, 0 )
+    ENDIF
+
+!
 !-- Check whether there are any illegal values
 !-- Pressure solver:
@@ -1027,4 +1042,15 @@
 
 !
+!-- Store reference time for coupled runs and change the coupling flag,
+!-- if ...
+    IF ( simulated_time == 0.0 )  THEN
+       IF ( coupling_start_time == 0.0 )  THEN
+          time_since_reference_point = 0.0
+       ELSEIF ( time_since_reference_point < 0.0 )  THEN
+          run_coupled = .FALSE.
+       ENDIF
+    ENDIF
+
+!
 !-- Set wind speed in the Galilei-transformed system
     IF ( galilei_transformation )  THEN
@@ -2813,5 +2839,7 @@
 !-- internal parameter for steering restart events)
     IF ( restart_time /= 9999999.9 )  THEN
-       IF ( restart_time > simulated_time )  time_restart = restart_time
+       IF ( restart_time > time_since_reference_point )  THEN
+          time_restart = restart_time
+       ENDIF
     ELSE
 !
Index: /palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_2d.f90	(revision 290)
+++ /palm/trunk/SOURCE/data_output_2d.f90	(revision 291)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! simulated_time in NetCDF output replaced by time_since_reference_point.
 ! Output of NetCDF messages with aid of message handling routine.
 ! Output of messages replaced by message handling routine.
@@ -567,5 +568,5 @@
                             nc_stat = NF90_PUT_VAR( id_set_xy(av),             &
                                                     id_var_time_xy(av),        &
-                                                    (/ simulated_time /),      &
+                                             (/ time_since_reference_point /), &
                                          start = (/ do2d_xy_time_count(av) /), &
                                                     count = (/ 1 /) )
@@ -753,5 +754,5 @@
                             nc_stat = NF90_PUT_VAR( id_set_xz(av),             &
                                                     id_var_time_xz(av),        &
-                                                    (/ simulated_time /),      &
+                                             (/ time_since_reference_point /), &
                                          start = (/ do2d_xz_time_count(av) /), &
                                                     count = (/ 1 /) )
@@ -960,5 +961,5 @@
                             nc_stat = NF90_PUT_VAR( id_set_yz(av),             &
                                                     id_var_time_yz(av),        &
-                                                    (/ simulated_time /),      &
+                                             (/ time_since_reference_point /), &
                                          start = (/ do2d_yz_time_count(av) /), &
                                                     count = (/ 1 /) )
Index: /palm/trunk/SOURCE/data_output_3d.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_3d.f90	(revision 290)
+++ /palm/trunk/SOURCE/data_output_3d.f90	(revision 291)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! simulated_time in NetCDF output replaced by time_since_reference_point.
 ! Output of NetCDF messages with aid of message handling routine.
 ! Output of messages replaced by message handling routine.
@@ -93,5 +94,5 @@
     IF ( myid == 0  .AND.  netcdf_output )  THEN
        nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_time_3d(av), &
-                               (/ simulated_time /),              &
+                               (/ time_since_reference_point /),  &
                                start = (/ do3d_time_count(av) /), &
                                count = (/ 1 /) )
Index: /palm/trunk/SOURCE/data_output_profiles.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_profiles.f90	(revision 290)
+++ /palm/trunk/SOURCE/data_output_profiles.f90	(revision 291)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! simulated_time in NetCDF output replaced by time_since_reference_point.
 ! Output of NetCDF messages with aid of message handling routine.
 ! Output of messages replaced by message handling routine.
@@ -356,7 +357,7 @@
 !
 !--       Store time to time axis          
-          nc_stat = NF90_PUT_VAR( id_set_pr, id_var_time_pr,     &
-                                  (/ simulated_time /),          &
-                                  start = (/ dopr_time_count /), &
+          nc_stat = NF90_PUT_VAR( id_set_pr, id_var_time_pr,        &
+                                  (/ time_since_reference_point /), &
+                                  start = (/ dopr_time_count /),    &
                                   count = (/ 1 /) )
           CALL handle_netcdf_error( 'data_output_profiles', 338 )
Index: /palm/trunk/SOURCE/data_output_ptseries.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_ptseries.f90	(revision 290)
+++ /palm/trunk/SOURCE/data_output_ptseries.f90	(revision 291)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! simulated_time in NetCDF output replaced by time_since_reference_point.
 ! Output of NetCDF messages with aid of message handling routine.
 !
@@ -55,6 +56,6 @@
 !
 !--    Update the particle time series time axis
-       nc_stat = NF90_PUT_VAR( id_set_pts, id_var_time_pts,    &
-                               (/ simulated_time /),           &
+       nc_stat = NF90_PUT_VAR( id_set_pts, id_var_time_pts,      &
+                               (/ time_since_reference_point /), &
                                start = (/ dopts_time_count /), count = (/ 1 /) )
        CALL handle_netcdf_error( 'data_output_ptseries', 391 )
Index: /palm/trunk/SOURCE/data_output_spectra.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_spectra.f90	(revision 290)
+++ /palm/trunk/SOURCE/data_output_spectra.f90	(revision 291)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! simulated_time in NetCDF output replaced by time_since_reference_point.
 ! Output of NetCDF messages with aid of message handling routine.
 ! Output of messages replaced by message handling routine.
@@ -65,5 +66,6 @@
 !
 !--    Update the spectra time axis
-       nc_stat = NF90_PUT_VAR( id_set_sp, id_var_time_sp, (/ simulated_time /),&
+       nc_stat = NF90_PUT_VAR( id_set_sp, id_var_time_sp,        &
+                               (/ time_since_reference_point /), &
                                start = (/ dosp_time_count /), count = (/ 1 /) )
        CALL handle_netcdf_error( 'data_output_spectra', 47 )
Index: /palm/trunk/SOURCE/data_output_tseries.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_tseries.f90	(revision 290)
+++ /palm/trunk/SOURCE/data_output_tseries.f90	(revision 291)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! simulated_time in NetCDF output replaced by time_since_reference_point.
 ! Output of NetCDF messages with aid of message handling routine.
 !
@@ -63,7 +64,7 @@
 !
 !--       Update the time series time axis
-          nc_stat = NF90_PUT_VAR( id_set_ts, id_var_time_ts,     &
-                                  (/ simulated_time /),          &
-                                  start = (/ dots_time_count /), &
+          nc_stat = NF90_PUT_VAR( id_set_ts, id_var_time_ts,        &
+                                  (/ time_since_reference_point /), &
+                                  start = (/ dots_time_count /),    &
                                   count = (/ 1 /) )
           CALL handle_netcdf_error( 'data_output_tseries', 350 )
Index: /palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/flow_statistics.f90	(revision 290)
+++ /palm/trunk/SOURCE/flow_statistics.f90	(revision 291)
@@ -4,4 +4,6 @@
 ! Current revisions:
 ! -----------------
+! Temperature gradient criterion for estimating the boundary layer height
+! replaced by the gradient criterion of Sullivan et al. (1998).
 ! Output of messages replaced by message handling routine.
 !
@@ -83,6 +85,7 @@
     INTEGER ::  i, j, k, omp_get_thread_num, sr, tn
     LOGICAL ::  first
-    REAL    ::  height, pts, sums_l_eper, sums_l_etot, ust, ust2, u2, vst, &
-                vst2, v2, w2, z_i(2)
+    REAL    ::  dptdz_threshold, height, pts, sums_l_eper, sums_l_etot, ust, &
+                ust2, u2, vst, vst2, v2, w2, z_i(2)
+    REAL    ::  dptdz(nzb+1:nzt+1)
     REAL    ::  sums_ll(nzb:nzt+1,2)
 
@@ -949,21 +952,32 @@
 
 !
-!--    Second scheme: Starting from the top/bottom model boundary, look for
-!--    the first characteristic kink in the temperature profile, where the
-!--    originally stable stratification notably weakens.
+!--    Second scheme: Gradient scheme from Sullivan et al. (1998), modified 
+!--    by Uhlenbrock(2006). The boundary layer height is the height with the 
+!--    maximal local temperature gradient: starting from the second (the last
+!--    but one) vertical gridpoint, the local gradient must be at least 
+!--    0.2K/100m and greater than the next four gradients.
+!--    WARNING: The threshold value of 0.2K/100m must be adjusted for the
+!--             ocean case! 
        z_i(2) = 0.0
+       DO  k = nzb+1, nzt+1
+          dptdz(k) = ( hom(k,1,4,sr) - hom(k-1,1,4,sr) ) * ddzu(k)
+       ENDDO
+       dptdz_threshold = 0.2 / 100.0
+
        IF ( ocean )  THEN
-          DO  k = nzb+1, nzt-1
-             IF ( ( hom(k,1,4,sr) - hom(k-1,1,4,sr) ) > &
-                  2.0 * ( hom(k+1,1,4,sr) - hom(k,1,4,sr) ) )  THEN
-                z_i(2) = zu(k)
+          DO  k = nzt+1, nzb+5, -1
+             IF ( dptdz(k) > dptdz_threshold  .AND.                           &
+                  dptdz(k) > dptdz(k-1)  .AND.  dptdz(k) > dptdz(k-2)  .AND.  &
+                  dptdz(k) > dptdz(k-3)  .AND.  dptdz(k) > dptdz(k-4) )  THEN
+                z_i(2) = zw(k-1)
                 EXIT
              ENDIF
           ENDDO
        ELSE
-          DO  k = nzt-1, nzb+1, -1
-             IF ( ( hom(k+1,1,4,sr) - hom(k,1,4,sr) ) > &
-                  2.0 * ( hom(k,1,4,sr) - hom(k-1,1,4,sr) ) )  THEN
-                z_i(2) = zu(k)
+          DO  k = nzb+1, nzt-3
+             IF ( dptdz(k) > dptdz_threshold  .AND.                           &
+                  dptdz(k) > dptdz(k+1)  .AND.  dptdz(k) > dptdz(k+2)  .AND.  &
+                  dptdz(k) > dptdz(k+3)  .AND.  dptdz(k) > dptdz(k+4) )  THEN
+                z_i(2) = zw(k-1)
                 EXIT
              ENDIF
Index: /palm/trunk/SOURCE/header.f90
===================================================================
--- /palm/trunk/SOURCE/header.f90	(revision 290)
+++ /palm/trunk/SOURCE/header.f90	(revision 291)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! Coupling with independent precursor runs.
 ! Output of messages replaced by message handling routine.
 ! Output of cluster_size
@@ -105,5 +106,5 @@
 
     INTEGER ::  av, bh, blx, bly, bxl, bxr, byn, bys, ch, cwx, cwy, cxl, cxr, &
-         cyn, cys, i, ihost, io, j, l, ll
+                cyn, cys, i, ihost, io, j, l, ll, mpi_type
     REAL    ::  cpuseconds_per_simulated_second
 
@@ -151,5 +152,12 @@
     ver_rev = TRIM( version ) // '  ' // TRIM( revision )
     WRITE ( io, 100 )  ver_rev, TRIM( run_classification )
-    IF ( coupling_mode /= 'uncoupled' )  WRITE ( io, 101 )  coupling_mode
+    IF ( TRIM( coupling_mode ) /= 'uncoupled' )  THEN
+#if defined( __mpi2 )
+       mpi_type = 2
+#else
+       mpi_type = 1
+#endif
+       WRITE ( io, 101 )  mpi_type, coupling_mode
+    ENDIF
     WRITE ( io, 102 )  run_date, run_identifier, run_time, runnr, &
                        ADJUSTR( host_chr )
@@ -344,4 +352,18 @@
           ENDIF
        ENDIF
+    ENDIF
+
+!
+!-- Start time for coupled runs, if independent precursor runs for atmosphere
+!-- and ocean are used. In this case, coupling_start_time defines the time
+!-- when the coupling is switched on.
+    IF ( coupling_start_time /= 0.0 )  THEN
+       IF ( coupling_start_time >= simulated_time_at_begin )  THEN
+          char1 = 'Precursor run for a coupled atmosphere-ocean run'
+       ELSE
+          char1 = 'Coupled atmosphere-ocean run following independent ' // &
+                  'precursor runs'
+       ENDIF
+       WRITE ( io, 207 )  char1, coupling_start_time
     ENDIF
 
@@ -1351,5 +1373,5 @@
             1X,'* ',A,' *',9X,A/                               &
             1X,'***************************',9X,42('-'))
-101 FORMAT (37X,'coupled run: ',A/ &
+101 FORMAT (37X,'coupled run using MPI-',I1,': ',A/ &
             37X,42('-'))
 102 FORMAT (/' Date:              ',A8,9X,'Run:       ',A20/      &
@@ -1448,4 +1470,5 @@
              '                                   per second of simulated tim', &
                'e: ',F9.3,' s')
+207 FORMAT ( A/' Coupling start time:',F9.3,' s')
 250 FORMAT (//' Computational grid and domain size:'/ &
               ' ----------------------------------'// &
Index: /palm/trunk/SOURCE/init_coupling.f90
===================================================================
--- /palm/trunk/SOURCE/init_coupling.f90	(revision 290)
+++ /palm/trunk/SOURCE/init_coupling.f90	(revision 291)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Coupling with independent precursor runs.
 !
 ! Former revisions:
@@ -27,5 +27,5 @@
 !-- Local variables
     INTEGER               ::  i, inter_color
-    INTEGER, DIMENSION(:) ::  bc_data(0:2) = 0
+    INTEGER, DIMENSION(:) ::  bc_data(0:3) = 0
 
 !
@@ -48,5 +48,4 @@
        READ (*,*,ERR=10,END=10)  coupling_mode, bc_data(1), bc_data(2)
 10     CONTINUE
-
 #if defined( __mpi2 )
        IF ( TRIM( coupling_mode ) == 'atmosphere_to_ocean' )  THEN
@@ -64,8 +63,14 @@
        ENDIF
 #endif
-    bc_data(0) = i
+       bc_data(0) = i
+
+!
+!--    Check if '_O' has to be used as file extension in an uncoupled ocean
+!--    run. This is required, if this run shall be continued as a coupled run.
+       IF ( TRIM( coupling_mode ) == 'precursor_ocean' )  bc_data(3) = 1
+
     ENDIF
 
-    CALL MPI_BCAST( bc_data(0), 3, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr )
+    CALL MPI_BCAST( bc_data(0), 4, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr )
     i = bc_data(0)
 
@@ -114,5 +119,11 @@
 #endif
 
-    IF ( coupling_mode == 'ocean_to_atmosphere' )  coupling_char = '_O'
+!
+!-- In case of a precursor ocean run (followed by a coupled run), or a
+!-- coupled atmosphere-ocean run, set the file extension for the ocean files
+    IF ( TRIM( coupling_mode ) == 'ocean_to_atmosphere' .OR. bc_data(3) == 1 ) &
+    THEN
+       coupling_char = '_O'
+    ENDIF
 
  END SUBROUTINE init_coupling
Index: /palm/trunk/SOURCE/modules.f90
===================================================================
--- /palm/trunk/SOURCE/modules.f90	(revision 290)
+++ /palm/trunk/SOURCE/modules.f90	(revision 291)
@@ -11,7 +11,7 @@
 ! topography color in dvrp_variables,
 ! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
-! canyon_wall_south, conserve_volume_flow_mode, dp_external, dp_level_b, 
-! dp_level_ind_b, dp_smooth, dp_smooth_factor, dpdxy, u_bulk, v_bulk in 
-! control_parameters
+! canyon_wall_south, conserve_volume_flow_mode, coupling_start_time,
+! dp_external, dp_level_b, dp_level_ind_b, dp_smooth, dp_smooth_factor, dpdxy,
+! run_coupled, time_since_reference_point, u_bulk, v_bulk in control_parameters
 !
 ! Former revisions:
@@ -380,6 +380,7 @@
                 profil_output = .FALSE., radiation = .FALSE., &
                 random_heatflux = .FALSE., run_control_header = .FALSE., &
-                sloping_surface = .FALSE., stop_dt = .FALSE., &
-                terminate_run = .FALSE., turbulent_inflow = .FALSE., &
+                run_coupled = .TRUE., sloping_surface = .FALSE., &
+                stop_dt = .FALSE., terminate_run = .FALSE., &
+                turbulent_inflow = .FALSE., &
                 use_prior_plot1d_parameters = .FALSE., use_reference = .FALSE.,&
                 use_surface_fluxes = .FALSE., use_top_fluxes = .FALSE., &
@@ -401,6 +402,6 @@
              canyon_width_x = 9999999.9, canyon_width_y = 9999999.9, &
              canyon_wall_left = 9999999.9, canyon_wall_south = 9999999.9, &
-             cthf = 0.0, cfl_factor = -1.0, &
-             cos_alpha_surface, disturbance_amplitude = 0.25, &
+             cthf = 0.0, cfl_factor = -1.0, cos_alpha_surface, &
+             coupling_start_time, disturbance_amplitude = 0.25, &
              disturbance_energy_limit = 0.01, &
              disturbance_level_b = -9999999.9, &
@@ -454,5 +455,6 @@
              time_do_av = 0.0, time_do_sla = 0.0, time_dvrp = 0.0, &
              time_prel = 0.0, time_restart = 9999999.9, time_run_control = 0.0,&
-             top_heatflux = 9999999.9, top_momentumflux_u = 9999999.9, &
+             time_since_reference_point, top_heatflux = 9999999.9, &
+             top_momentumflux_u = 9999999.9, &
              top_momentumflux_v = 9999999.9, top_salinityflux = 9999999.9, &
              ug_surface = 0.0, u_bulk = 0.0, u_gtrans = 0.0, &
Index: /palm/trunk/SOURCE/parin.f90
===================================================================
--- /palm/trunk/SOURCE/parin.f90	(revision 290)
+++ /palm/trunk/SOURCE/parin.f90	(revision 291)
@@ -7,6 +7,6 @@
 ! Output of messages replaced by message handling routine.
 ! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
-! canyon_wall_south, conserve_volume_flow_mode, dp_external, dp_level_b, 
-! dp_smooth, dpdxy, u_bulk, v_bulk in inipar
+! canyon_wall_south, conserve_volume_flow_mode, coupling_start_time,
+! dp_external, dp_level_b, dp_smooth, dpdxy, u_bulk, v_bulk in inipar
 ! topography_grid_convention moved from userpar
 !
@@ -94,5 +94,5 @@
              canyon_wall_left, canyon_wall_south, cloud_droplets, &
              cloud_physics, conserve_volume_flow, conserve_volume_flow_mode, &
-             cthf, cut_spline_overshoot, &
+             coupling_start_time, cthf, cut_spline_overshoot, &
              damp_level_1d, dissipation_1d, dp_external, dp_level_b, &
              dp_smooth, dpdxy, drag_coefficient, dt, dt_pr_1d, &
Index: /palm/trunk/SOURCE/prandtl_fluxes.f90
===================================================================
--- /palm/trunk/SOURCE/prandtl_fluxes.f90	(revision 290)
+++ /palm/trunk/SOURCE/prandtl_fluxes.f90	(revision 291)
@@ -4,5 +4,6 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Saturation condition at (sea) surface is not used in precursor runs (only
+! in the following coupled runs)
 !
 ! Former revisions:
@@ -278,6 +279,8 @@
 
 !
-!--             assume saturation for atmosphere coupled to ocean
-                IF ( coupling_mode == 'atmosphere_to_ocean' )  THEN
+!--             Assume saturation for atmosphere coupled to ocean (but not
+!--             in case of precursor runs)
+                IF ( coupling_mode == 'atmosphere_to_ocean' .AND. run_coupled )&
+                THEN
                    e_q = 6.1 * &
                         EXP( 0.07 * ( MIN(pt(0,j,i),pt(1,j,i)) - 273.15 ) )
Index: /palm/trunk/SOURCE/read_var_list.f90
===================================================================
--- /palm/trunk/SOURCE/read_var_list.f90	(revision 290)
+++ /palm/trunk/SOURCE/read_var_list.f90	(revision 291)
@@ -6,6 +6,7 @@
 ! Output of messages replaced by message handling routine.
 ! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
-! canyon_wall_south, conserve_volume_flow_mode, dp_external, dp_level_b, 
-! dp_smooth, dpdxy, topography_grid_convention, u_bulk, v_bulk
+! canyon_wall_south, conserve_volume_flow_mode, coupling_start_time,
+! dp_external, dp_level_b, dp_smooth, dpdxy, run_coupled,
+! time_since_reference_point, topography_grid_convention, u_bulk, v_bulk
 !
 ! Former revisions:
@@ -242,4 +243,6 @@
           CASE ( 'conserve_volume_flow_mode' )
              READ ( 13 )  conserve_volume_flow_mode
+          CASE ( 'coupling_start_time' )
+             READ ( 13 )  coupling_start_time
           CASE ( 'cthf' )
              READ ( 13 )  cthf
@@ -428,4 +431,6 @@
           CASE ( 'runnr' )
              READ ( 13 )  runnr
+          CASE ( 'run_coupled' )
+             READ ( 13 )  run_coupled
           CASE ( 'sa_init' )
              READ ( 13 )  sa_init
@@ -492,4 +497,6 @@
           CASE ( 'time_run_control' )
              READ ( 13 )  time_run_control
+          CASE ( 'time_since_reference_point' )
+             READ ( 13 )  time_since_reference_point
           CASE ( 'time_sort_particles' )
              READ ( 13 )  time_sort_particles
Index: /palm/trunk/SOURCE/surface_coupler.f90
===================================================================
--- /palm/trunk/SOURCE/surface_coupler.f90	(revision 290)
+++ /palm/trunk/SOURCE/surface_coupler.f90	(revision 291)
@@ -4,4 +4,5 @@
 ! Current revisions:
 ! -----------------
+! Coupling with independent precursor runs.
 ! Output of messages replaced by message handling routine.
 !
@@ -35,5 +36,5 @@
     INTEGER ::  i, j, k
 
-    REAL    ::  simulated_time_remote
+    REAL    ::  time_since_reference_point_rem
 
 #if defined( __parallel )
@@ -65,12 +66,16 @@
        RETURN
     ENDIF
+
 !
 !-- Exchange the current simulated time between the models,
 !-- currently just for testing
-    CALL MPI_SEND( simulated_time, 1, MPI_REAL, target_id, 11, &
+    CALL MPI_SEND( time_since_reference_point, 1, MPI_REAL, target_id, 11, &
                    comm_inter, ierr )
-    CALL MPI_RECV( simulated_time_remote, 1, MPI_REAL, target_id, 11, &
+    CALL MPI_RECV( time_since_reference_point_rem, 1, MPI_REAL, target_id, 11, &
                    comm_inter, status, ierr )
-    WRITE ( 9, * )  simulated_time, ' remote: ', simulated_time_remote
+    WRITE ( 9, * ) 'simulated time: ', simulated_time
+    WRITE ( 9, * ) 'time since start of coupling: ', &
+                   time_since_reference_point, ' remote: ', &
+                   time_since_reference_point_rem
     CALL local_flush( 9 )
 
Index: /palm/trunk/SOURCE/time_integration.f90
===================================================================
--- /palm/trunk/SOURCE/time_integration.f90	(revision 290)
+++ /palm/trunk/SOURCE/time_integration.f90	(revision 291)
@@ -4,5 +4,6 @@
 ! Actual revisions:
 ! -----------------
-! Bugfix: output if particle time series only if particle advection is switched
+! Coupling with independent precursor runs.
+! Bugfix: output of particle time series only if particle advection is switched
 !         on
 !
@@ -88,5 +89,5 @@
 !-- Data exchange between coupled models in case that a call has been omitted 
 !-- at the end of the previous run of a job chain.
-    IF ( coupling_mode /= 'uncoupled' )  THEN
+    IF ( coupling_mode /= 'uncoupled'  .AND.  run_coupled )  THEN
 !
 !--    In case of model termination initiated by the local model the coupler 
@@ -295,7 +296,9 @@
 !
 !--    Increase simulation time and output times
-       current_timestep_number = current_timestep_number + 1
-       simulated_time     = simulated_time   + dt_3d
-       simulated_time_chr = time_to_string( simulated_time )
+       current_timestep_number    = current_timestep_number + 1
+       simulated_time             = simulated_time   + dt_3d
+       simulated_time_chr         = time_to_string( simulated_time )
+       time_since_reference_point = simulated_time - coupling_start_time
+
        IF ( simulated_time >= skip_time_data_output_av )  THEN
           time_do_av         = time_do_av       + dt_3d
@@ -329,5 +332,5 @@
 !
 !--    Data exchange between coupled models
-       IF ( coupling_mode /= 'uncoupled' )  THEN
+       IF ( coupling_mode /= 'uncoupled'  .AND.  run_coupled )  THEN
           time_coupling = time_coupling + dt_3d
 !
Index: /palm/trunk/SOURCE/write_var_list.f90
===================================================================
--- /palm/trunk/SOURCE/write_var_list.f90	(revision 290)
+++ /palm/trunk/SOURCE/write_var_list.f90	(revision 291)
@@ -5,6 +5,7 @@
 ! -----------------
 ! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left, 
-! canyon_wall_south, conserve_volume_flow_mode, dp_external, dp_level_b, 
-! dp_smooth, dpdxy, topography_grid_convention, u_bulk, v_bulk
+! canyon_wall_south, conserve_volume_flow_mode, coupling_start_time,
+! dp_external, dp_level_b, dp_smooth, dpdxy, run_coupled,
+! time_since_reference_point, topography_grid_convention, u_bulk, v_bulk
 !
 ! Former revisions:
@@ -171,4 +172,6 @@
     WRITE ( 14 )  'conserve_volume_flow_mode     '
     WRITE ( 14 )  conserve_volume_flow_mode
+    WRITE ( 14 )  'coupling_start_time           '
+    WRITE ( 14 )  coupling_start_time
     WRITE ( 14 )  'current_timestep_number       '
     WRITE ( 14 )  current_timestep_number
@@ -353,4 +356,6 @@
     WRITE ( 14 )  'runnr                         '
     WRITE ( 14 )  runnr
+    WRITE ( 14 )  'run_coupled                   '
+    WRITE ( 14 )  run_coupled
     WRITE ( 14 )  'sa_init                       '
     WRITE ( 14 )  sa_init
@@ -417,4 +422,6 @@
     WRITE ( 14 )  'time_run_control              '
     WRITE ( 14 )  time_run_control
+    WRITE ( 14 )  'time_since_reference_point    '
+    WRITE ( 14 )  time_since_reference_point
     WRITE ( 14 )  'time_sort_particles           '
     WRITE ( 14 )  time_sort_particles
