Index: palm/trunk/SCRIPTS/.mrun.config.default
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.default	(revision 180)
+++ palm/trunk/SCRIPTS/.mrun.config.default	(revision 181)
@@ -45,4 +45,28 @@
 %fopts             -axW:-cpp:-g:-CB:-inline_debug_info:-r8:-nbs:-convert:little:endian     lcmuk trace
 %lopts             -axW:-cpp:-g:-CB:-inline_debug_info:-r8:-nbs:-Vaxlib                    lcmuk trace
+#
+%sgi_feature       ice                                        lcsgih parallel
+#%remote_username   <replace by your HLRN username>            lcsgih parallel
+%compiler_name     mpif90                                     lcsgih parallel
+%compiler_name_ser ifort                                      lcsgih parallel
+%cpp_options       -DMPI_REAL=MPI_DOUBLE_PRECISION:-DMPI_2REAL=MPI_2DOUBLE_PRECISION:-D__netcdf:-D__netcdf_64bit   lcsgih parallel
+%netcdf_inc        -I:/sw/dataformats/netcdf/3.6.2/include          lcsgih parallel
+%netcdf_lib        -L/sw/dataformats/netcdf/3.6.2/lib:-lnetcdf:-lnetcdff      lcsgih parallel
+%fopts             -g:-w:-xT:-O3:-cpp:-openmp:-r8:-ftz:-fno-alias:-no-prec-div:-no-prec-sqrt:-ip:-nbs:-convert:little_endian  lcsgih parallel
+%lopts             -g:-w:-xT:-O3:-cpp:-openmp:-r8:-ftz:-fno-alias:-no-prec-div:-no-prec-sqrt:-ip:-nbs:-Vaxlib:-i-dynamic      lcsgih parallel
+#%tmp_data_catalog  /gfs1/work/<replace by your HLRN username>/palm_restart_data      lcsgih parallel
+#%tmp_user_catalog  /gfs1/tmp/<replace by your HLRN username>                         lcsgih parallel
+#
+%sgi_feature       ice                                        lcsgih parallel debug
+#%remote_username   <replace by your HLRN username>            lcsgih parallel debug
+%compiler_name     mpif90                                     lcsgih parallel debug
+%compiler_name_ser ifort                                      lcsgih parallel debug
+%cpp_options       -DMPI_REAL=MPI_DOUBLE_PRECISION:-DMPI_2REAL=MPI_2DOUBLE_PRECISION:-D__netcdf:-D__netcdf_64bit   lcsgih parallel debug
+%netcdf_inc        -I:/sw/dataformats/netcdf/3.6.2/include          lcsgih parallel debug
+%netcdf_lib        -L/sw/dataformats/netcdf/3.6.2/lib:-lnetcdf:-lnetcdff      lcsgih parallel debug
+%fopts             -C:-fpe0:-debug:-traceback:-g:-w:-xT:-O0:-cpp:-r8:-ftz:-fno-alias:-no-prec-div:-no-prec-sqrt:-ip:-nbs:-convert:little_endian  lcsgih parallel debug
+%lopts             -C:-fpe0:-debug:-traceback:-g:-w:-xT:-O0:-cpp:-r8:-ftz:-fno-alias:-no-prec-div:-no-prec-sqrt:-ip:-nbs:-Vaxlib:-i-dynamic      lcsgih parallel debug
+#%tmp_data_catalog  /gfs1/work/<replace by your HLRN username>/palm_restart_data      lcsgih parallel debug
+#%tmp_user_catalog  /gfs1/tmp/<replace by your HLRN username>                         lcsgih parallel debug
 #
 #%remote_username   <replace by your tsubame username>              lctit parallel 
Index: palm/trunk/SCRIPTS/mbuild
===================================================================
--- palm/trunk/SCRIPTS/mbuild	(revision 180)
+++ palm/trunk/SCRIPTS/mbuild	(revision 181)
@@ -91,4 +91,7 @@
      #                    host identifier (local_host) is read from config file
      # 10/10/07 - Siggi - bugfix: handling of comment lines
+     # 18/07/08 - Siggi - adapted for lcsgih
+     # 21/07/08 - Siggi - mainprog (executable) is added to the tar-file
+     #                    ({mainprog}_current_version)
 
 
@@ -723,4 +726,6 @@
     case  $remote_host  in
         (lcmuk)          remote_addres=130.75.105.2;;
+        (lcsgib)         remote_addres=130.73.232.102;;
+        (lcsgih)         remote_addres=130.75.4.102;;
         (lctit)          remote_addres=172.17.75.161;;
         (decalpha)       remote_addres=165.132.26.56;;
@@ -1299,4 +1304,10 @@
                 print "export OBJECT_MODE=64; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
 
+             elif [[ $remote_host = lcsgib  ||  $remote_host = lcsgih ]]
+             then
+
+                print ". /usr/share/modules/init/bash; module load mvapich/mvapich-0.9.9-intel; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+#                print ". /usr/share/modules/init/bash; module load mvapich2/1.2-intel; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
+
              elif [[ $remote_host = lctit ]]
              then
@@ -1343,9 +1354,9 @@
              if [[ $remote_host != lctit ]]
              then
-                ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  *.f90 *.o *.mod"
+                ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  ${mainprog}  *.f90 *.o *.mod"
              else
                    # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
                    # MIT SSH, DESHALB AUFRUF PER PIPE
-                print  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  *.f90 *.o *.mod"  |  ssh  ${remote_username}@${remote_addres}  2>&1
+                print  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  ${mainprog}  *.f90 *.o *.mod"  |  ssh  ${remote_username}@${remote_addres}  2>&1
              fi
 
Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 180)
+++ palm/trunk/SCRIPTS/mrun	(revision 181)
@@ -581,5 +581,5 @@
     do_remote=true
     case  $host  in
-        (ibm|ibmb|ibmh|ibms|ibmy|nech|neck|lctit|unics)  true;;
+        (ibm|ibmb|ibmh|ibms|ibmy|nech|neck|lcsgib|lcsgih|lctit|unics)  true;;
         (*)  printf "\n"
              printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
@@ -700,5 +700,5 @@
                    do_remote=true
                    case  $host  in
-                       (ibm|ibms|ibmy|lctit|nech|neck|unics)  true;;
+                       (ibm|ibms|ibmy|lcsgib|lcsgih|lctit|nech|neck|unics)  true;;
                        (*)  printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
                             printf "\n      is not available"
@@ -955,5 +955,5 @@
     do_remote=true
     case  $host  in
-        (ibm|ibmb|ibmh|ibms|ibmy|lctit|nech|neck|unics)  true;;
+        (ibm|ibmb|ibmh|ibms|ibmy|lcsgib|lcsgih|lctit|nech|neck|unics)  true;;
         (*)  printf "\n"
              printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
@@ -1043,9 +1043,13 @@
        then
           node_usage=sla3
+       elif [[ $(echo $host | cut -c1-5) = lcsgi ]]
+       then
+          node_usage=singlejob
        else
           node_usage=not_shared
        fi
     fi
-    if [[ $node_usage != shared  &&  $node_usage != not_shared  &&  "$(echo $node_usage | cut -c1-3)" != "sla"  &&  $node_usage != novice  ]]
+
+    if [[ $node_usage != shared  &&  $node_usage != not_shared  &&  $node_usage != singlejob  &&  "$(echo $node_usage | cut -c1-3)" != "sla"  &&  $node_usage != novice  ]]
     then
        printf "\n"
@@ -2244,5 +2248,10 @@
           printf "\n  +++ error occured while compiling or linking"
           locat=compile
-          exit
+
+  # WORKAROUND: REMOVE IF LATER, BUT KEEP THE EXIT!
+          if [[ $localhost != lcsgib  &&  $localhost != lcsgih ]]
+          then
+             exit
+          fi
        else
           printf "$striche\n  *** compilation finished \n"
@@ -2787,8 +2796,11 @@
                 if [[ $host = lcsgih  ||  $host = lcsgib ]]
                 then
-                   echo "  --- Content of \$PBS_NODEFILE:"
-                   cat $PBS_NODEFILE
-                   echo "  --- end content"
-                   mpirun -machinefile $PBS_NODEFILE -np $ii  a.out  $ROPTS
+#                   mpirun -machinefile $PBS_NODEFILE -np $ii  a.out  $ROPTS
+                   ulimit -s 30000
+                   ulimit -a
+                   mpirun_rsh -hostfile $PBS_NODEFILE -np $ii  OMP_NUM_THREADS=$OMP_NUM_THREADS  palm  $ROPTS
+#                   export MV2_NUM_PORTS=2
+#                   export MV2_CPU_MAPPING=0:1:2:3
+#                   mpiexec    ./palm  $ROPTS
                 elif [[ $host = lcxt4 ]]
                 then
Index: palm/trunk/SCRIPTS/subjob
===================================================================
--- palm/trunk/SCRIPTS/subjob	(revision 180)
+++ palm/trunk/SCRIPTS/subjob	(revision 181)
@@ -160,4 +160,5 @@
      (breg*-en0|berni*-en0)  local_addres=130.73.230.10;  local_host=ibmb;;
      (breva)                 local_addres=130.75.105.98;  local_host=lcmuk;;
+     (b01*)                  local_addres=130.73.232.102; local_host=lcsgih;;
      (compute-*.local)       local_addres=172.20.4.2;     local_host=lcfimm;;
      (cs*)                   local_addres=136.172.44.131; local_host=nech;;
@@ -172,5 +173,5 @@
      (hexagon.bccs.uib.no)   local_addres=129.177.20.113; local_host=lcxt4;;
      (hreg*-en0|hanni*-en0)  local_addres=130.75.4.10;    local_host=ibmh;;
-     (h01*)                  local_addres=10.152.0.7;     local_host=lcsgih;;
+     (h01*)                  local_addres=130.75.4.102;   local_host=lcsgih;;
      (irifi)                 local_addres=130.75.105.104; local_host=lcmuk;;
      (levanto)               local_addres=130.75.105.45;  local_host=lcmuk;;
@@ -182,7 +183,8 @@
      (quanero)               local_addres=130.75.105.107; local_host=lcmuk;;
      (scirocco)              local_addres=172.20.25.41;   local_host=lcmuk;;
-     (service100)            local_addres=10.152.0.7;     local_host=lcsgih;;
+     (service100)            local_addres=130.75.4.102;   local_host=lcsgih;;
      (sun1|sun2)             local_addres=130.75.6.1;     local_host=unics;;
-     (r1*)                   local_addres=10.152.0.7;     local_host=lcsgih;;
+     (r1*)                   local_addres=130.75.4.102;   local_host=lcsgih;;
+     (r2*)                   local_addres=130.73.232.102; local_host=lcsgih;;
      (tgg*)                  local_addres=172.17.75.161;  local_host=lctit;;
      (vorias)                local_addres=172.20.25.43;   local_host=lcmuk;;
@@ -310,5 +312,6 @@
         (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;;
-        (lcsgih) remote_addres=10.152.0.7; submcom=/opt/moab/bin/msub;;
+        (lcsgib) remote_addres=130.73.232.102; submcom=/opt/torque/bin/qsub;;
+        (lcsgih) remote_addres=130.75.4.102; submcom=/opt/torque/bin/qsub;;
         (lctit)  queue=lctit; remote_addres=172.17.75.161; submcom=/n1ge/TITECH_GRID/tools/bin/n1ge;;
         (lcxt4)	 remote_addres=129.177.20.113; submcom=/opt/torque/2.3.0/bin/qsub;;
@@ -666,5 +669,5 @@
     fi
 
- elif [[ $remote_host = lcsgih ]]
+ elif [[ $remote_host = lcsgih  ||  $remote_host = lcsgib ]]
  then
 
@@ -672,9 +675,10 @@
     then
        cat > $job_to_send << %%END%%
-#PBS -S /bin/bash
+#!/bin/bash
 #PBS -N $job_name
 #PBS -l walltime=$timestring
-#PBS -l nodes=$nodes:ppn=${tasks_per_node}:xe
-#PBS -l naccesspolicy=singlejob
+#PBS -l nodes=$nodes:ppn=${tasks_per_node}
+#PBS -l feature=$sgi_feature
+#PBS -l naccesspolicy=$node_usage
 #PBS -o $remote_dayfile
 #PBS -j oe
@@ -682,8 +686,8 @@
 . /usr/share/modules/init/bash
 module load mvapich/mvapich-0.9.9-intel
+# module load mvapich2/1.2-intel
 module load netcdf
-export LD_LIBRARY_PATH=/sw/intel/fce/10.1.015/lib:/sw/dataformats/netcdf/3.6.2/lib:$LD_LIBRARY_PATH
-
-echo ld_library_path=$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH=/sw/intel/cce/10.1.015/lib:/sw/intel/fce/10.1.015/lib:/sw/dataformats/netcdf/3.6.2/lib:\$LD_LIBRARY_PATH
+echo ld_library_path=\$LD_LIBRARY_PATH
 
 %%END%%
@@ -860,5 +864,5 @@
     echo "trap '"                               >>  $job_to_send
     echo "set +vx"                              >>  $job_to_send
-    if [[ $(echo $remote_host | cut -c1-3) = ibm  ||  $(echo $remote_host | cut -c1-3) = nec  ||  $remote_host = lctit ]]
+    if [[ $(echo $remote_host | cut -c1-3) = ibm  ||  $(echo $remote_host | cut -c1-5) = lcsgi  ||  $(echo $remote_host | cut -c1-3) = nec  ||  $remote_host = lctit ]]
     then
        if [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]
@@ -926,4 +930,22 @@
           echo "set -x"                            >>  $job_to_send
           echo "batch_scp  -d  -w 10  -u $local_user $local_addres  $remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
+          echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
+          echo "%%END%%"                           >>  $job_to_send
+
+       elif [[ $(echo $remote_host | cut -c1-5) = lcsgi ]]
+       then
+          echo "cat > scpjob.$kennung << %%END%%"  >>  $job_to_send
+          echo "#!/bin/bash"                             >>  $job_to_send
+          echo "#PBS -N job_protocol_transfer"           >>  $job_to_send
+          echo "#PBS -l walltime=00:02:00"               >>  $job_to_send
+          echo "#PBS -l nodes=1:ppn=1"                   >>  $job_to_send
+          echo "#PBS -l feature=xe"                      >>  $job_to_send
+          echo "#PBS -l naccesspolicy=shared"            >>  $job_to_send
+          echo "#PBS -o \$HOME/job_queue/last_job_transfer_protocol"      >>  $job_to_send
+          echo "#PBS -j oe"                        >>  $job_to_send
+          echo " "                                 >>  $job_to_send
+          echo ". /usr/share/modules/init/bash"    >>  $job_to_send
+          echo "set -x"                            >>  $job_to_send
+          echo "batch_scp  -d  -w 10  -u $local_user $local_addres  ${job_catalog}/$remote_dayfile  \"$job_catalog\"  $local_dayfile"  >>  $job_to_send
           echo "[[ \"\$for_subjob_to_do\" != \"\" ]]  &&  eval \$for_subjob_to_do"  >>  $job_to_send
           echo "%%END%%"                           >>  $job_to_send
@@ -968,4 +990,8 @@
        then
           echo "llsubmit  scpjob.$kennung"      >>  $job_to_send
+       elif [[ $(echo $remote_host | cut -c1-5) = lcsgi ]]
+       then
+          echo "chmod  u+x  scpjob.$kennung"    >>  $job_to_send
+          echo "msub  scpjob.$kennung"          >>  $job_to_send
        elif [[ $remote_host = lctit ]]
        then
Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 180)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 181)
@@ -42,4 +42,6 @@
 Changed:
 -------
+Strict grid matching along z is not needed for mg-solver. (check_parameters)
+
 Sharp lateral edges of the plant canopy introduced. Before smaller 
 values of the leaf area density than those applied in the prognostic 
@@ -72,9 +74,15 @@
 Workaround for getting information about the coupling mode. (palm)
 
-advec_s_ups, advec_u_ups, advec_v_ups, advec_w_ups, calc_spectra, check_open, init_3d_model, modules, palm, parin, poisfft, read_var_list, read_3d_binary, transpose, write_var_list, write_3d_binary
+Format adjustments in order to allow CPU# > 999. (cpu_statistics)
+
+advec_s_ups, advec_u_ups, advec_v_ups, advec_w_ups, calc_spectra, check_open, check_parameters, cpu_statistics, init_3d_model, modules, palm, parin, poisfft, read_var_list, read_3d_binary, transpose, write_var_list, write_3d_binary
 
 
 Errors:
 ------
+Bugfix: zero assignments to tendency arrays in case of restarts (init_3d_model)
+
+Bugfix: wrong grid level used in multigrid solver, routine restrict (poismg)
+
 Bugfix: Construction of vertical profiles when 10 gradients have been 
 specified in the parameter list (ug, vg, pt, q, sa, lad). (check_parameters)
@@ -109,4 +117,4 @@
 
 
-check_parameters, flow_statistics, init_dvrp, local_stop, plant_canopy_model, pres, read_3d_binary, user_interface, write_3d_binary
+check_parameters, flow_statistics, init_dvrp, init_3d_model, local_stop, plant_canopy_model, poismg, pres, read_3d_binary, user_interface, write_3d_binary
 
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 180)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 181)
@@ -5,6 +5,7 @@
 ! -----------------
 ! Bug fix: Construction of vertical profiles when 10 gradients have been 
-! specified in the parameter list (ug, vg, pt, q, sa, lad)  
-!
+! specified in the parameter list (ug, vg, pt, q, sa, lad)
+!   
+! Strict grid matching along z is not needed for mg-solver.
 ! Leaf area density (LAD) explicitly set to its surface value at k=0
 ! Case of reading data for recycling included in initializing_actions,
@@ -369,6 +370,8 @@
        CALL local_stop
     ENDIF
-    IF ( ( psolver == 'poisfft_hybrid'  .OR.  psolver == 'multigrid' )  .AND.  &
-         ( nxra > nxr  .OR.  nyna > nyn  .OR.  nza > nz ) )  THEN
+    IF ( psolver == 'poisfft_hybrid'  .AND.                     &
+         ( nxra > nxr  .OR.  nyna > nyn  .OR.  nza > nz )  .OR. &
+          psolver == 'multigrid'      .AND.                     &
+         ( nxra > nxr  .OR.  nyna > nyn ) )  THEN
        IF ( myid == 0 )  THEN
           PRINT*, '+++ check_parameters:'
Index: palm/trunk/SOURCE/cpu_statistics.f90
===================================================================
--- palm/trunk/SOURCE/cpu_statistics.f90	(revision 180)
+++ palm/trunk/SOURCE/cpu_statistics.f90	(revision 181)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Format adjustments in order to allow CPU# > 999
 !
 ! Former revisions:
@@ -125,5 +125,5 @@
        CALL check_open( 18 )
        WRITE ( 18, 100 )  TRIM( run_description_header ),        &
-                          numprocs * threads_per_task, numprocs, &
+                          numprocs * threads_per_task, pdims(1), pdims(2), &
                           threads_per_task
        DO
@@ -249,7 +249,8 @@
 
 
-100 FORMAT (A/11('-')//'CPU measures for ',I3,' PEs (',I3,' tasks *',I3,    &
-            &' threads):'/ &
-             &'--------------------------------------------------'//        &
+100 FORMAT (A/11('-')//'CPU measures for ',I5,' PEs (',I5,'(x) * ',I5,'(y', &
+            &') tasks *',I5,' threads):'/ &
+             &'----------------------------------------------------------', &
+             &'------------'//&
             &'place:                        mean        counts      min  ', &
              &'     max       rms'/ &
Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 180)
+++ palm/trunk/SOURCE/init_3d_model.f90	(revision 181)
@@ -7,9 +7,11 @@
 ! Actual revisions:
 ! -----------------
+! Bugfix: zero assignments to tendency arrays in case of restarts
 ! Further amendments to and modifications in the initialisation of the plant 
 ! canopy model 
 ! Allocation of hom_sum moved to parin, initialization of spectrum_x|y directly
 ! after allocating theses arrays,
-! read data for recycling added as new initialization option
+! read data for recycling added as new initialization option,
+! dummy allocation for diss
 !
 ! Former revisions:
@@ -235,4 +237,7 @@
     IF ( use_sgs_for_particles )  THEN
        ALLOCATE ( diss(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
+    ELSE
+       ALLOCATE ( diss(2,2,2) )  ! required because diss is used as a
+                                 ! formal parameter
     ENDIF
 
@@ -1046,4 +1051,14 @@
        IF ( humidity  .OR.  passive_scalar )  q_p = q
        IF ( ocean )  sa_p = sa
+
+!
+!--    Allthough tendency arrays are set in prognostic_equations, they have
+!--    have to be predefined here because they are used (but multiplied with 0)
+!--    there before they are set. 
+       IF ( timestep_scheme(1:5) == 'runge' )  THEN
+          te_m = 0.0; tpt_m = 0.0; tu_m = 0.0; tv_m = 0.0; tw_m = 0.0
+          IF ( humidity  .OR.  passive_scalar )  tq_m = 0.0
+          IF ( ocean )  tsa_m = 0.0
+       ENDIF
 
     ELSE
Index: palm/trunk/SOURCE/init_pegrid.f90
===================================================================
--- palm/trunk/SOURCE/init_pegrid.f90	(revision 180)
+++ palm/trunk/SOURCE/init_pegrid.f90	(revision 181)
@@ -4,4 +4,6 @@
 ! Actual revisions:
 ! -----------------
+! ATTENTION: nnz_x undefined problem still has to be solved!!!!!!!!
+! nz is used instead nnz for calculating mg-levels
 ! Collect on PE0 horizontal index bounds from all other PEs,
 ! broadcast the id of the inflow PE (using the respective communicator)
@@ -340,4 +342,15 @@
 
        sendrecvcount_zx = nnx * nny * nnz_x
+
+    ELSE
+!
+!---   Setting of dummy values because otherwise variables are undefined in
+!---   the next step  x --> y
+!---   WARNING: This case has still to be clarified!!!!!!!!!!!!
+       nnz_x  = 1
+       nzb_x  = 1
+       nzt_xa = 1
+       nzt_x  = 1
+       nny_x  = nny
 
     ENDIF
@@ -694,5 +707,6 @@
        ENDDO
 
-       k = nnz
+       k = nz    ! do not use nnz because it might be > nz due to transposition
+                 ! requirements
        DO WHILE ( MOD( k, 2 ) == 0  .AND.  k /= 2 )
           k = k / 2
Index: palm/trunk/SOURCE/poismg.f90
===================================================================
--- palm/trunk/SOURCE/poismg.f90	(revision 180)
+++ palm/trunk/SOURCE/poismg.f90	(revision 181)
@@ -8,5 +8,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Bugfix: grid_level+1 has to be used in restrict for flags-array
 !
 ! Former revisions:
@@ -274,5 +274,5 @@
 !
 !-- Choose flag array of the upper level
-    SELECT CASE ( l )
+    SELECT CASE ( l+1 )
        CASE ( 1 )
           flags => wall_flags_1
