Index: /palm/trunk/SCRIPTS/mbuild
===================================================================
--- /palm/trunk/SCRIPTS/mbuild	(revision 677)
+++ /palm/trunk/SCRIPTS/mbuild	(revision 678)
@@ -1043,5 +1043,10 @@
           if [[ "$modules" != "" ]]
           then
-             module_calls="module load ${modules};"
+             if [[ $remote_host = lctit ]]
+             then
+                module_calls=". $modules"
+             else
+                module_calls="module load ${modules};"
+             fi
 
                 # bugfix for wrong netcdf module
@@ -1203,5 +1208,10 @@
           if [[ "$modules" != "" ]]
           then
-             module_calls="module load ${modules};"
+             if [[ $remote_host = lctit ]]
+             then
+                module_calls=". $modules"
+             else
+                module_calls="module load ${modules};"
+             fi
 
                 # bugfix for wrong netcdf module
@@ -1263,5 +1273,10 @@
        if [[ "$modules" != "" ]]
        then
-          module load ${modules}
+          if [[ $remote_host = lctit ]]
+          then
+             . $modules
+          else
+             module load ${modules}
+          fi
        fi
 
Index: /palm/trunk/SCRIPTS/mrun
===================================================================
--- /palm/trunk/SCRIPTS/mrun	(revision 677)
+++ /palm/trunk/SCRIPTS/mrun	(revision 678)
@@ -217,4 +217,7 @@
      # 23/12/10 - Micha  - different number of processors in ocean and atmosphere
      #                     is now allowed 
+     # 02/02/10 - Siggi  - further adjustments on Tsubame and concerning openMP
+     #                     usage
+
 
 
@@ -2102,5 +2105,10 @@
  if [[ "$modules" != "" ]]
  then
-    export module_calls="module load ${modules};"
+    if [[ $host = lctit ]]
+    then
+       export module_calls=". $modules"
+    else
+       export module_calls="module load ${modules};"
+    fi
  fi
 
@@ -3314,8 +3322,14 @@
                #          export MV2_CPU_MAPPING=0,1,4,5,2,3,6,7
                #       fi
-                      [[ $use_openmp = true ]]  &&  unset MV2_CPU_MAPPING
-                      echo "*** MV2_CPU_MAPPING=$MV2_CPU_MAPPING"
                       if [[ $use_openmp = true ]]
                       then
+                         unset MV2_CPU_MAPPING
+                         export MV2_ENABLE_AFFINITY=0
+                      fi
+                      echo "*** MV2_CPU_MAPPING=$MV2_CPU_MAPPING"
+                      echo "*** MV2_ENABLE_AFFINITY=$MV2_ENABLE_AFFINITY"
+                      if [[ $use_openmp = true ]]
+                      then
+                         echo " mpiexec -npernode $tasks_per_node  ./a.out  $ROPTS  <  runfile_atmos"
                          mpiexec -npernode $tasks_per_node  ./a.out  $ROPTS  <  runfile_atmos
                       else
@@ -3435,5 +3449,16 @@
           elif [[ $host = lctit ]]
           then
-             mpirun  -np $numprocs  -hostfile $PBS_NODEFILE ./a.out  $ROPTS
+             export OMP_NUM_THREADS=$threads_per_task
+             echo "OMP_NUM_THREADS=$OMP_NUM_THREADS"
+             if [[ "$threads_per_task" != 1 ]]
+             then
+                export MV2_ENABLE_AFFINITY=0
+             fi
+             echo "----- PBS_NODEFILE content:"
+             cat $PBS_NODEFILE
+             echo "-----"
+             (( ii = $numprocs / $threads_per_task ))
+             echo "mpirun  -np $ii  -hostfile $PBS_NODEFILE ./a.out  $ROPTS"
+             mpirun  -np $ii  -hostfile $PBS_NODEFILE ./a.out  $ROPTS
           else
              mpprun  -n $numprocs  a.out  $ROPTS
Index: /palm/trunk/SCRIPTS/subjob
===================================================================
--- /palm/trunk/SCRIPTS/subjob	(revision 677)
+++ /palm/trunk/SCRIPTS/subjob	(revision 678)
@@ -126,4 +126,6 @@
      # 14/12/10 - Siggi - adjustments for new Tsubame system at Tokyo
      #                    institute of technology (lctit)
+     # 02/02/11 - Siggi - further asjustments for Tsubame concerning openMP
+
 
 
@@ -1038,8 +1040,15 @@
 #!/bin/ksh
 
+$module_calls
+
 %%END%%
 
        # OPTIONEN FUER SUBMIT-KOMMANDO ZUSAMMENSTELLEN
-    submcom="$submcom -W group_list=$group_number -N $job_name -l walltime=$timestring -l select=$nodes:ncpus=$processes_per_node:mpiprocs=$tasks_per_node:mem=${Memory}gb -l place=scatter -o $remote_dayfile -j oe -q $queue "
+    if [[ $tasks_per_node != $processes_per_node ]]
+    then
+       submcom="$submcom -W group_list=$group_number -N $job_name -l walltime=$timestring -l select=$nodes:ncpus=$processes_per_node:mpiprocs=$tasks_per_node:mem=${Memory}gb -o $remote_dayfile -j oe -q $queue "
+    else
+       submcom="$submcom -W group_list=$group_number -N $job_name -l walltime=$timestring -l select=$nodes:ncpus=$processes_per_node:mpiprocs=$tasks_per_node:mem=${Memory}gb -l place=scatter -o $remote_dayfile -j oe -q $queue "
+    fi
 
  else
Index: /palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/flow_statistics.f90	(revision 677)
+++ /palm/trunk/SOURCE/flow_statistics.f90	(revision 678)
@@ -4,4 +4,6 @@
 ! Current revisions:
 ! -----------------
+! Bugfix in calculation of divergence of vertical flux of resolved scale
+! energy, pressure fluctuations, and flux of pressure fluctuation itself
 !
 ! Former revisions:
@@ -802,8 +804,8 @@
                    sums_ll(k,1) = sums_ll(k,1) + 0.5 * w(k,j,i) * (        &
                   ( 0.25 * ( u(k,j,i)+u(k+1,j,i)+u(k,j,i+1)+u(k+1,j,i+1)   &
-                           - 2.0 * ( hom(k,1,1,sr) + hom(k+1,1,1,sr) )     &
+                           - 0.5 * ( hom(k,1,1,sr) + hom(k+1,1,1,sr) )     &
                            ) )**2                                          &
                 + ( 0.25 * ( v(k,j,i)+v(k+1,j,i)+v(k,j+1,i)+v(k+1,j+1,i)   &
-                           - 2.0 * ( hom(k,1,2,sr) + hom(k+1,1,2,sr) )     &
+                           - 0.5 * ( hom(k,1,2,sr) + hom(k+1,1,2,sr) )     &
                            ) )**2                                          &
                    + w(k,j,i)**2                                  )
@@ -820,5 +822,5 @@
           sums_ll(nzt+1,2) = 0.0
 
-          DO  k = nzb_s_inner(j,i)+1, nzt
+          DO  k = nzb+1, nzt
              sums_l(k,55,tn) = ( sums_ll(k,1) - sums_ll(k-1,1) ) * ddzw(k)
              sums_l(k,56,tn) = ( sums_ll(k,2) - sums_ll(k-1,2) ) * ddzw(k)
Index: /palm/trunk/SOURCE/user_statistics.f90
===================================================================
--- /palm/trunk/SOURCE/user_statistics.f90	(revision 677)
+++ /palm/trunk/SOURCE/user_statistics.f90	(revision 678)
@@ -4,5 +4,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! Bugfix: module pegrid was missing
 !
 ! Former revisions:
@@ -35,4 +35,5 @@
     USE indices
     USE netcdf_control
+    USE pegrid
     USE statistics
     USE user
