Index: palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90
===================================================================
--- palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 2841)
+++ palm/trunk/SOURCE/synthetic_turbulence_generator_mod.f90	(revision 2894)
@@ -25,4 +25,14 @@
 ! -----------------
 ! $Id$
+! variable named found has been introduced for checking if restart data was found, 
+! reading of restart strings has been moved completely to read_restart_data_mod, 
+! redundant skipping function has been removed, stg_read/write_restart_data 
+! have been renamed to stg_r/wrd_global, stg_rrd_global is called in 
+! read_restart_data_mod now, flag syn_turb_gen_prerun and marker *** end stg
+! *** have been removed (Giersch), strings and their respective lengths are 
+! written out and read now in case of restart runs to get rid of prescribed 
+! character lengths (Giersch), CASE DEFAULT was added if restart data is read 
+! 
+! 2841 2018-02-27 15:02:57Z suehring
 ! Bugfix: wrong placement of include 'mpif.h' corrected
 ! 
@@ -44,5 +54,5 @@
 ! 
 ! 2576 2017-10-24 13:49:46Z Giersch
-! Definition of a new function called stg_skip_var_list to skip module 
+! Definition of a new function called stg_skip_global to skip module 
 ! parameters during reading restart data
 ! 
@@ -92,5 +102,5 @@
     USE control_parameters,                                                    &
         ONLY:  initializing_actions, message_string,                           &
-               syn_turb_gen, syn_turb_gen_prerun
+               syn_turb_gen
 
     USE cpulog,                                                                &
@@ -208,20 +218,14 @@
 
 !
-!-- Skipping of parameters for restart runs
-    INTERFACE stg_skip_var_list 
-       MODULE PROCEDURE stg_skip_var_list
-    END INTERFACE stg_skip_var_list
-
-!
 !-- Reading of parameters for restart runs
-    INTERFACE stg_read_restart_data
-       MODULE PROCEDURE stg_read_restart_data
-    END INTERFACE stg_read_restart_data
+    INTERFACE stg_rrd_global
+       MODULE PROCEDURE stg_rrd_global
+    END INTERFACE stg_rrd_global
 
 !
 !-- Writing of binary output for restart runs
-    INTERFACE stg_write_restart_data
-       MODULE PROCEDURE stg_write_restart_data
-    END INTERFACE stg_write_restart_data
+    INTERFACE stg_wrd_global
+       MODULE PROCEDURE stg_wrd_global
+    END INTERFACE stg_wrd_global
 
     SAVE
@@ -232,5 +236,5 @@
 !-- Public interfaces
     PUBLIC  stg_check_parameters, stg_header, stg_init, stg_main, stg_parin,   &
-            stg_write_restart_data, stg_skip_var_list
+            stg_wrd_global, stg_rrd_global
 
 !
@@ -702,35 +706,8 @@
     syn_turb_gen = .TRUE.
 
-    IF ( TRIM( initializing_actions ) == 'read_restart_data' ) THEN
-       CALL stg_read_restart_data
-    ENDIF
 
  10 CONTINUE
 
  END SUBROUTINE stg_parin
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Skipping the stg variables from restart-file (binary format).
-!------------------------------------------------------------------------------!
-   SUBROUTINE stg_skip_var_list 
-        
-      IMPLICIT NONE
-            
-      CHARACTER (LEN=1)  ::  cdum
-      CHARACTER (LEN=30) ::  variable_chr
-            
-      READ ( 13 )  variable_chr
-
-      DO  WHILE ( TRIM( variable_chr ) /= '*** end stg module ***' )
-
-         READ ( 13 )  cdum
-         READ ( 13 )  variable_chr
-
-      ENDDO   
-            
-   END SUBROUTINE stg_skip_var_list 
 
 
@@ -740,31 +717,34 @@
 !> This routine reads the respective restart data.
 !------------------------------------------------------------------------------!
- SUBROUTINE stg_read_restart_data
+ SUBROUTINE stg_rrd_global( found )
+
+
+    USE control_parameters,                                                    &
+        ONLY: length, restart_string
 
 
     IMPLICIT NONE
 
-    CHARACTER (LEN=30) ::  variable_chr  !< dummy variable to read string
-
-
-    READ ( 13 )  variable_chr
-    DO  WHILE ( TRIM( variable_chr ) /= '*** end stg module ***' )
-
-       SELECT CASE ( TRIM( variable_chr ) )
-
-          CASE ( 'use_syn_turb_gen' )
-             READ ( 13 )  use_syn_turb_gen
-          CASE ( 'mc_factor' )
-             READ ( 13 )  mc_factor
-          CASE ( 'syn_turb_gen_prerun' )
-             READ ( 13 )  syn_turb_gen_prerun
-
-       END SELECT
-
-       READ ( 13 )  variable_chr
-
-    ENDDO
-
- END SUBROUTINE stg_read_restart_data
+    LOGICAL, INTENT(OUT)  ::  found 
+
+
+    found = .TRUE.
+ 
+
+    SELECT CASE ( restart_string(1:length) )
+
+       CASE ( 'mc_factor' )
+          READ ( 13 )  mc_factor
+       CASE ( 'use_syn_turb_gen' )
+          READ ( 13 )  use_syn_turb_gen
+
+       CASE DEFAULT
+
+          found = .FALSE.   
+
+    END SELECT
+
+
+ END SUBROUTINE stg_rrd_global
 
 
@@ -774,21 +754,18 @@
 !> This routine writes the respective restart data.
 !------------------------------------------------------------------------------!
- SUBROUTINE stg_write_restart_data
+ SUBROUTINE stg_wrd_global
 
 
     IMPLICIT NONE
 
-    syn_turb_gen_prerun = .TRUE.
-
-    WRITE ( 14 )  'use_syn_turb_gen              '
+
+    CALL wrd_write_string( 'mc_factor' )
+    WRITE ( 14 )  mc_factor
+
+    CALL wrd_write_string( 'use_syn_turb_gen' )
     WRITE ( 14 )  use_syn_turb_gen
-    WRITE ( 14 )  'mc_factor                     '
-    WRITE ( 14 )  mc_factor
-    WRITE ( 14 )  'syn_turb_gen_prerun           '
-    WRITE ( 14 )  syn_turb_gen_prerun
-
-    WRITE ( 14 )  '*** end stg module ***        '
-
-END SUBROUTINE stg_write_restart_data
+
+
+ END SUBROUTINE stg_wrd_global
 
 
