Index: palm/trunk/UTIL/surface_output_processing/surface_output_to_vtk.f90
===================================================================
--- palm/trunk/UTIL/surface_output_processing/surface_output_to_vtk.f90	(revision 4784)
+++ palm/trunk/UTIL/surface_output_processing/surface_output_to_vtk.f90	(revision 4786)
@@ -25,8 +25,11 @@
 ! -----------------
 ! $Id$
+! Creation of in- and output filenames simplified
+!
+! 4481 2020-03-31 18:55:54Z maronga
 ! - Give path to surface data directly
 ! - Remove non-used input variables
-! - Output 5 relevant digits for the point data in order to account also for
-!   small grid spacings
+! - Output of 5 relevant digits rather than 1 for the point data in order
+!   to account also for small grid spacings
 ! 
 ! 4481 2020-03-31 18:55:54Z maronga
@@ -388,41 +391,26 @@
 !--       string. The header information must be given in each VTK file!
           IF ( f == 0 )  THEN
-             IF ( simulated_time < 10.0_wp )  THEN
-                WRITE( char_dum, '(I1)' )  INT( simulated_time ) 
-             ELSEIF ( simulated_time < 100.0_wp )  THEN
-                WRITE( char_dum, '(I2)' )  INT( simulated_time )
-             ELSEIF ( simulated_time < 1000.0_wp )  THEN
-                WRITE( char_dum, '(I3)' )  INT( simulated_time )
-             ELSEIF ( simulated_time < 10000.0_wp )  THEN
-                WRITE( char_dum, '(I4)' )  INT( simulated_time )   
-             ELSEIF ( simulated_time < 100000.0_wp )  THEN
-                WRITE( char_dum, '(I5)' )  INT( simulated_time )   
-             ELSEIF ( simulated_time < 1000000.0_wp )  THEN
-                WRITE( char_dum, '(I6)' )  INT( simulated_time )
-             ELSEIF ( simulated_time < 10000000.0_wp )  THEN
-                WRITE( char_dum, '(I7)' )  INT( simulated_time )   
-             ELSEIF ( simulated_time < 100000000.0_wp )  THEN
-                WRITE( char_dum, '(I8)' )  INT( simulated_time )   
-             ELSEIF ( simulated_time < 1000000000.0_wp )  THEN
-                WRITE( char_dum, '(I9)' )  INT( simulated_time )
-             ENDIF             
+             WRITE( char_dum, '(I9.0)' )  INT( simulated_time )
+             print*, char_dum, TRIM(ADJUSTL(char_dum))
 !
 !--          Copy HEADER file and open VTK file
              IF ( convert_average_data )  THEN
                 CALL system('cp HEADER ' //                                    &
-                            TRIM( path ) // TRIM( char_dum ) //                & 
+                            TRIM( path ) // TRIM( ADJUSTL(char_dum) ) //       & 
                             '_AV_' // 's_' // TRIM( variable_name ) // '.vtk' )
-                            
-                OPEN ( file_id_out, FILE = TRIM( path ) // TRIM( char_dum ) // & 
+
+                OPEN ( file_id_out, FILE = TRIM( path ) //                     &
+                       TRIM( ADJUSTL(char_dum) ) //                            & 
                        '_AV_' // 's_' // TRIM( variable_name ) // '.vtk',      &
                        FORM='FORMATTED', POSITION = 'APPEND' )  
              ELSE
                 CALL system('cp HEADER ' //                                    &
-                            TRIM( path ) // TRIM( char_dum ) //                & 
+                            TRIM( path ) // TRIM(ADJUSTL(char_dum)) //         & 
                             's_' // TRIM( variable_name ) // '.vtk' )
-                            
-                OPEN ( file_id_out, FILE = TRIM( path ) // TRIM( char_dum ) // & 
+
+                OPEN ( file_id_out, FILE = TRIM( path ) //                     &
+                       TRIM( ADJUSTL(char_dum) ) //                            & 
                        's_' // TRIM( variable_name ) // '.vtk',                &
-                       FORM='FORMATTED', POSITION = 'APPEND' )  
+                       FORM='FORMATTED', POSITION = 'APPEND' )
              ENDIF
 
@@ -505,26 +493,9 @@
 !
 !--    Create substring for the processor id and combine all substrings.
-       IF ( f < 10 )  THEN
-          WRITE( char_dum, '(I1)')  f
-          myid_char = TRIM( char_av ) // '_00000' // TRIM( char_dum )
-       ELSEIF ( f < 100     )  THEN
-          WRITE( char_dum, '(I2)')  f
-          myid_char = TRIM( char_av ) // '_0000'  // TRIM( char_dum )
-       ELSEIF ( f < 1000    )  THEN
-          WRITE( char_dum, '(I3)')  f
-          myid_char = TRIM( char_av ) // '_000'   // TRIM( char_dum )
-       ELSEIF ( f < 10000   )  THEN
-          WRITE( char_dum, '(I4)')  f
-          myid_char = TRIM( char_av ) // '_00'    // TRIM( char_dum )
-       ELSEIF ( f < 100000  )  THEN
-          WRITE( char_dum, '(I5)')  f
-          myid_char = TRIM( char_av ) // '_0'     // TRIM( char_dum )
-       ELSEIF ( f < 1000000 )  THEN
-          WRITE( char_dum, '(I6)')  f
-          myid_char = TRIM( char_av ) // '_'      // TRIM( char_dum )
-       ENDIF
-       
+       WRITE( char_dum, '(I6.6)') f
+       myid_char = TRIM( char_av ) // '_' // TRIM( char_dum )
+
     END SUBROUTINE surface_output_create_file_string
-        
+
  END PROGRAM surface_output_to_vtk
 
