Index: /palm/trunk/SCRIPTS/palmrun
===================================================================
--- /palm/trunk/SCRIPTS/palmrun	(revision 2637)
+++ /palm/trunk/SCRIPTS/palmrun	(revision 2638)
@@ -535,16 +535,15 @@
           # LINE DEFINES FILE CONNECTION. READ THE FILE ATTRIBUTES.
           # s2a: in/out - field
-          # s2b: loc    - field (optional)
-          # s2c: tr/ar  - field (optional)
+          # s2b: action - field (optional)
        s1=`echo $line | cut -d" " -f1`
        s2=`echo $line | cut -d" " -s -f2`
-       s2a=$(echo $s2 | cut -d":" -f1)
+#       s2a=$(echo $s2 | cut -d":" -f1)
        if [[ $(echo $s2 | grep -c ":") = 0 ]]
        then
+          s2a=$s2
           s2b=""
-          s2c=""
        else
-          s2b=`echo $s2 | cut -d":" -f2 | sed 's/:/ /g'`
-          s2c=`echo $s2 | cut -d":" -s -f3 | sed 's/:/ /g'`
+          s2a=`echo $s2 | cut -d":" -f1`
+          s2b=`echo $s2 | cut -d":" -f2`
        fi
        s3=`echo $line | cut -d" " -f3`
@@ -558,8 +557,8 @@
           # VARIABLE S3 MAY CONTAIN A LIST OF ACTIVATION STRINGS (FIELD-SEPERATOR ":").
           # IF EXECUTION IS SCHEDULED FOR A REMOTE-MACHINE AND THE FILE IS ONLY
-          # LOCALLY REQUIRED ON THAT MACHINE (I.E. s2b = loc), THE FILE CONNECTION
+          # LOCALLY REQUIRED ON THAT MACHINE (I.E. s2b != tr), THE FILE CONNECTION
           # IS NOT CHECKED AND STORED.
        IFSALT="$IFS"; IFS="$IFS:"      # ADD ":" AS FIELD SEPARATOR
-       if [[ "$s2a" = in  &&  ! ( $create_remote_batch_job = true  &&  ( "$s2b" = loc  ||  "$s2b" = locopt ) ) ]]
+       if [[ ( "$s2a" = in  || "$s2a" = inopt )  &&  ! ( $create_remote_batch_job = true  &&  "$s2b" != tr ) ]]
        then
           found=false
@@ -574,10 +573,16 @@
           then
              (( iin = iin + 1 ))
-             localin_pre[$iin]=$s1; transin_pre[$iin]=$s2b; actionin_pre[$iin]=$s2c;
+             localin_pre[$iin]=$s1; actionin_pre[$iin]=$s2b;
              pathin_pre[$iin]=$s4; endin_pre[$iin]=$s5; extin_pre[$iin]=$s6
+             if [[ "$s2a" = inopt ]]
+             then
+                optin_pre[$iin]=yes
+             else
+                optin_pre[$iin]=no
+             fi 
 
                 # FILES WITH JOB-ATTRIBUTE ARE STORED IN THE SOURCES_FOR_RUN
                 # FOLDER IF THE JOB IS RUNNING ON A REMOTE HOST
-             if [[ $running_on_remote = true  && ( "$s2b" = job  ||  "$s2b" = jobopt ) ]]
+             if [[ $running_on_remote = true  &&  "$s2b" = tr ]]
              then
                 pathin_pre[$iin]=${fast_io_catalog}/${sources_for_run_catalog}
@@ -588,5 +593,5 @@
              if [[ "${s5: -1}" = "*" ]]
              then
-                if [[ "$s2c" = "di" ]]
+                if [[ "$s2b" = "di" ]]
                 then
                    printf "\n    +++ wildcards (*) not allowed with \"di\" file attribute."
@@ -602,5 +607,5 @@
              fi
           fi
-       elif [[ "$s2a" = out  &&  ! ( $create_remote_batch_job = true  &&  "$s2b" = loc ) ]]
+       elif [[ "$s2a" = out  &&  ! ( $create_remote_batch_job = true ) ]]
        then
           found=false
@@ -615,5 +620,5 @@
           then
              (( iout = iout + 1 ))
-             localout_pre[$iout]=$s1; actionout_pre[$iout]=$s2c; typeout_pre[$iout]=$s3;
+             localout_pre[$iout]=$s1; actionout_pre[$iout]=$s2b; typeout_pre[$iout]=$s3;
              pathout_pre[$iout]=$s4; endout_pre[$iout]=$s5; extout_pre[$iout]=$s6
 
@@ -622,5 +627,5 @@
              if [[ "${s1: -1}" = "*" ]]
              then
-                if [[ "$s2c" = "di" ]]
+                if [[ "$s2b" = "di" ]]
                 then
                    printf "\n    +++ wildcards (*) not allowed with \"di\" file attribute."
@@ -636,8 +641,8 @@
              fi
           fi
-       elif [[ "$s2a" != in  &&  "$s2a" != out ]]
-       then
-          printf "\n  +++ I/O-attribute in configuration file $config_file has the invalid"
-          printf "\n      value \"$s2\". Only \"in\" and \"out\" are allowed!"
+       elif [[ "$s2a" != in  &&  "$s2a" != inopt  &&  "$s2a" != out ]]
+       then
+          printf "\n  +++ I/O-attribute in file $fileconnection_file has invalid"
+          printf "\n      value \"$s2\". Only \"in\", \"inopt\", and \"out\" are allowed!"
           locat=connect; exit
        fi
@@ -1024,6 +1029,6 @@
     then
 
-          # FILES WITH ATTRIBUTE locopt ARE OPTIONAL. NO ABORT, IF THEY DO NOT EXIST.
-       if [[ "${transin_pre[$i]}" != "locopt"  &&  "${transin_pre[$i]}" != "jobopt" ]]
+          # FILES WITH ATTRIBUTE opt ARE OPTIONAL. NO ABORT, IF THEY DO NOT EXIST.
+       if [[ "${optin_pre[$i]}" != "yes" ]]
        then
           printf "\n\n  +++ INPUT-file: "
@@ -1039,6 +1044,8 @@
           (( nr_of_input_files = nr_of_input_files + 1 ))
           localin[$nr_of_input_files]="${localin_pre[$i]}"
-          transin[$nr_of_input_files]="unavailable"
-          actionin[$nr_of_input_files]="${actionin_pre[$i]}"
+          optin[$nr_of_input_files]="${optin_pre[$i]}"
+#          transin[$nr_of_input_files]="unavailable"
+#          actionin[$nr_of_input_files]="${actionin_pre[$i]}"
+          actionin[$nr_of_input_files]="unavailable"
           pathin[$nr_of_input_files]="${pathin_pre[$i]}"
           endin[$nr_of_input_files]="${endin_pre[$i]}"
@@ -1128,5 +1135,6 @@
           (( nr_of_input_files = nr_of_input_files + 1 ))
           localin[$nr_of_input_files]="${localin_pre[$i]}"$ending
-          transin[$nr_of_input_files]="${transin_pre[$i]}"
+          optin[$nr_of_input_files]="${optin_pre[$i]}"
+#          transin[$nr_of_input_files]="${transin_pre[$i]}"
           actionin[$nr_of_input_files]="${actionin_pre[$i]}"
           pathin[$nr_of_input_files]="${pathin_pre[$i]}"
@@ -1755,6 +1763,6 @@
 
 
-    # WHEN CREATING A REMOTE BATCH JOB, THOSE INPUT FILES WITH JOB-ATTRIBUT WILL
-    # BE COPIED TO THE REMOTE HOST
+    # WHEN CREATING A REMOTE BATCH JOB, THOSE INPUT FILES WITH TRANSFER-ATTRIBUT
+    # WILL BE COPIED TO THE REMOTE HOST
  if [[ $create_remote_batch_job = true ]]
  then
@@ -1763,5 +1771,5 @@
     do
        (( i = i + 1 ))
-       if [[ "${transin[$i]}" = job  ||  "${transin[$i]}" = jobopt ]]
+       if [[ "${actionin[$i]}" = tr ]]
        then
           eval inputfile=${pathin[$i]}/${frelin[$i]}
@@ -1813,5 +1821,5 @@
 
           # SKIP OPTIONAL FILES, IF THEY DO NOT EXIST
-       if [[ "${transin[$i]}" = unavailable ]]
+       if [[ "${actionin[$i]}" = unavailable ]]
        then
           if [[ "${extin[$i]}" = ""  ||  "${extin[$i]}" = " " ]]
@@ -1887,5 +1895,5 @@
 
           # FILE IS STORED IN THE RESPECTIVE DIRECTORY GIVEN IN THE CONFIGURATION FILE
-       if [[ "${actionin[$i]}" = ""  ||  "${actionin[$i]}" = "di"  ||  "${actionin[$i]}" = "npe" ]]
+       if [[ "${actionin[$i]}" = ""  ||  "${actionin[$i]}" = "di"  ||  "${actionin[$i]}" = "tr"  ||  "${actionin[$i]}" = "npe" ]]
        then
 
@@ -1962,5 +1970,5 @@
                       printf "\n  --- WARNING: ln failed, using cp instead (might be time consuming...)"
 		                 fi
-                   if [[ $running_on_remote = true  &&  ( "${transin[$i]}" = job  ||  "${transin[$i]}" = jobopt ) ]]
+                   if [[ $running_on_remote = true  &&  "${actionin[$i]}" = tr ]]
                    then
                       mv  ${absnamein[$i]}  ${localin[$i]}
Index: /palm/trunk/SOURCE/diffusion_u.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_u.f90	(revision 2637)
+++ /palm/trunk/SOURCE/diffusion_u.f90	(revision 2638)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix for constant top momentumflux
+! 
+! 2233 2017-05-30 18:08:54Z suehring
 !
 ! 2232 2017-05-30 17:47:52Z suehring
@@ -328,5 +331,5 @@
 !
 !--          Add momentum flux at model top
-             IF ( use_top_fluxes )  THEN
+             IF ( use_top_fluxes  .AND.  constant_top_momentumflux )  THEN
                 surf_s = surf_def_h(2)%start_index(j,i)
                 surf_e = surf_def_h(2)%end_index(j,i)
@@ -550,5 +553,5 @@
 !
 !--    Add momentum flux at model top
-       IF ( use_top_fluxes )  THEN
+       IF ( use_top_fluxes  .AND.  constant_top_momentumflux )  THEN
           surf_s = surf_def_h(2)%start_index(j,i)
           surf_e = surf_def_h(2)%end_index(j,i)
Index: /palm/trunk/SOURCE/diffusion_v.f90
===================================================================
--- /palm/trunk/SOURCE/diffusion_v.f90	(revision 2637)
+++ /palm/trunk/SOURCE/diffusion_v.f90	(revision 2638)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix for constant top momentumflux
+! 
+! 2233 2017-05-30 18:08:54Z suehring
 !
 ! 2232 2017-05-30 17:47:52Z suehring
@@ -316,5 +319,5 @@
 !
 !--          Add momentum flux at model top
-             IF ( use_top_fluxes )  THEN
+             IF ( use_top_fluxes  .AND.  constant_top_momentumflux )  THEN
                 surf_s = surf_def_h(2)%start_index(j,i)
                 surf_e = surf_def_h(2)%end_index(j,i)
@@ -538,5 +541,5 @@
 !
 !--    Add momentum flux at model top
-       IF ( use_top_fluxes )  THEN
+       IF ( use_top_fluxes  .AND.  constant_top_momentumflux )  THEN
           surf_s = surf_def_h(2)%start_index(j,i)
           surf_e = surf_def_h(2)%end_index(j,i)
Index: /palm/trunk/SOURCE/surface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/surface_mod.f90	(revision 2637)
+++ /palm/trunk/SOURCE/surface_mod.f90	(revision 2638)
@@ -18,4 +18,5 @@
 !
 !------------------------------------------------------------------------------!
+!
 ! Current revisions:
 ! ------------------
@@ -25,4 +26,7 @@
 ! -----------------
 ! $Id$
+! bugfix for constant top momentumflux
+! 
+! 2575 2017-10-24 09:57:58Z maronga
 ! Pavement parameterization revised
 ! 
@@ -1543,8 +1547,10 @@
 !
 !--          Top momentum fluxes
-             surf%usws(num_h) = top_momentumflux_u *                           &
+             IF ( constant_top_momentumflux )  THEN
+                surf%usws(num_h) = top_momentumflux_u *                        &
                                             momentumflux_input_conversion(nzt+1)
-             surf%vsws(num_h) = top_momentumflux_v *                           &
+                surf%vsws(num_h) = top_momentumflux_v *                        &
                                             momentumflux_input_conversion(nzt+1)
+             ENDIF
 !
 !--          Increment surface indices
