Index: palm/trunk/DOC/app/chapter_3.4.html
===================================================================
--- palm/trunk/DOC/app/chapter_3.4.html	(revision 133)
+++ palm/trunk/DOC/app/chapter_3.4.html	(revision 134)
@@ -1,5 +1,4 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
+<html><head>
 
 
@@ -8,7 +7,5 @@
 
   
-  <title>PALM chapter 3.4</title>
-</head>
-
+  <title>PALM chapter 3.4</title></head>
 
 <body>
@@ -3423,11 +3420,40 @@
       <font color="#000000"><span style="font-family: Cumberland AMT;">&nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
-&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;S</span></font><br>
-
-
-      <span style="font-family: Arial;"></span><br>
-
-
-These data must exactly match the horizontal grid.<br>
+&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;S<br></span></font>
+
+
+      <br><span style="font-family: Arial;"></span><font color="#000000">Example for a 50m building surrounded by a 12.5m podium on flat ground:<br>
+
+
+      <span style="font-family: Cumberland AMT;"></span><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;">&nbsp;
+&nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0
+&nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp;
+&nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0<br></span></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"> &nbsp; &nbsp;0 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 &nbsp; &nbsp;0 &nbsp; &nbsp;0&nbsp;
+</span></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"><br></span></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"> </span></font></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"> &nbsp; &nbsp;0 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 &nbsp; &nbsp;0 &nbsp; &nbsp;0&nbsp;
+</span></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"><br></span></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"> </span></font></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;">&nbsp;
+&nbsp;0 12.5 12.5 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp; 50
+&nbsp; 50 12.5 12.5 &nbsp; &nbsp;0 &nbsp; &nbsp;0&nbsp;
+<br></span></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;">
+&nbsp; &nbsp;0 12.5 12.5 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp;
+50 &nbsp; 50 12.5 12.5 &nbsp; &nbsp;0 &nbsp; &nbsp;0&nbsp;
+<br></span></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;">
+&nbsp; &nbsp;0 12.5 12.5 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp;
+50 &nbsp; 50 12.5 12.5 &nbsp; &nbsp;0 &nbsp; &nbsp;0&nbsp;
+</span></font></font></font></font><br><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;">&nbsp; &nbsp;0 12.5 12.5 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp; 50 12.5 12.5 &nbsp; &nbsp;0 &nbsp; &nbsp;0 <br>
+</span></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;">
+&nbsp; &nbsp;0 12.5 12.5 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp;
+50 &nbsp; 50 12.5 12.5 &nbsp; &nbsp;0 &nbsp; &nbsp;0&nbsp;
+</span></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"><br></span></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;">
+&nbsp; &nbsp;0 12.5 12.5 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp; 50 &nbsp;
+50 &nbsp; 50 12.5 12.5 &nbsp; &nbsp;0 &nbsp; &nbsp;0&nbsp;
+<br></span></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"> &nbsp; &nbsp;0 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 &nbsp; &nbsp;0 &nbsp; &nbsp;0&nbsp;
+</span></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"><br></span></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"> </span></font></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"> &nbsp; &nbsp;0 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 12.5 &nbsp; &nbsp;0 &nbsp; &nbsp;0&nbsp;
+</span></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"><br></span></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"> </span></font></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;">&nbsp;
+&nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0
+&nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp;
+&nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; &nbsp;0<br></span></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font></font></font><font color="#000000"><font color="#000000"><font color="#000000"><span style="font-family: Cumberland AMT;"></span></font></font></font></font><br>
+
+
+These data must exactly match the horizontal grid. <font color="#000000">Due to the staggered grid the topography will be displaced by -0.5 <a href="chapter_4.1.html#dx">dx</a> in x-direction and -0.5 <a href="chapter_4.1.html#dy">dy</a> in y-direction.</font><br>
 
 
@@ -3436,8 +3462,5 @@
 
 
-      <td><br>
-
-
-      </td>
+      
 
 
@@ -3482,8 +3505,5 @@
 
 
-      <td style="vertical-align: top;"><br>
-
-
-      </td>
+      
 
 
@@ -3528,8 +3548,5 @@
 
 
-      <td style="vertical-align: top;"><br>
-
-
-      </td>
+      
 
 
@@ -3574,8 +3591,5 @@
 
 
-      <td style="vertical-align: top;"><br>
-
-
-      </td>
+      
 
 
@@ -3619,8 +3633,5 @@
 
 
-      <td style="vertical-align: top;"><br>
-
-
-      </td>
+      
 
 
@@ -3664,8 +3675,5 @@
 
 
-      <td style="vertical-align: top;"><br>
-
-
-      </td>
+      
 
 
@@ -3709,8 +3717,5 @@
 
 
-      <td style="vertical-align: top;"><br>
-
-
-      </td>
+      
 
 
@@ -3754,8 +3759,5 @@
 
 
-      <td style="vertical-align: top;"><br>
-
-
-      </td>
+      
 
 
@@ -3799,8 +3801,5 @@
 
 
-      <td style="vertical-align: top;"><br>
-
-
-      </td>
+      
 
 
@@ -3861,5 +3860,5 @@
 
 
-      <td align="left" valign="top"></td>
+      
 
 
@@ -3904,5 +3903,5 @@
 
 
-      <td></td>
+      
 
 
@@ -3948,5 +3947,5 @@
 
 
-      <td></td>
+      
 
 
@@ -3992,5 +3991,5 @@
 
 
-      <td></td>
+      
 
 
@@ -4035,5 +4034,5 @@
 
 
-      <td></td>
+      
 
 
@@ -4067,4 +4066,3 @@
 
 
-</body>
-</html>
+</body></html>
Index: palm/trunk/DOC/app/chapter_4.1.html
===================================================================
--- palm/trunk/DOC/app/chapter_4.1.html	(revision 133)
+++ palm/trunk/DOC/app/chapter_4.1.html	(revision 134)
@@ -2024,5 +2024,5 @@
 = <span style="font-style: italic;">( ( <a href="#nx">nx</a>&nbsp;+
 1 ) * <a href="#dx">dx</a> -&nbsp; <a href="#building_length_x">building_length_x</a> ) / 2</span>
-centers the building in x-direction. </td>
+centers the building in x-direction.&nbsp;<font color="#000000">Due to the staggered grid the building will be displaced by -0.5 <a href="chapter_4.1.html#dx">dx</a> in x-direction and -0.5 <a href="chapter_4.1.html#dy">dy</a> in y-direction.</font> </td>
 
 
@@ -2090,5 +2090,5 @@
 = <span style="font-style: italic;">( ( <a href="#ny">ny</a>&nbsp;+
 1 ) * <a href="#dy">dy</a> -&nbsp; <a href="#building_length_y">building_length_y</a> ) / 2</span>
-centers the building in y-direction. </td>
+centers the building in y-direction.&nbsp;<font color="#000000">Due to the staggered grid the building will be displaced by -0.5 <a href="chapter_4.1.html#dx">dx</a> in x-direction and -0.5 <a href="chapter_4.1.html#dy">dy</a> in y-direction.</font> </td>
 
 
@@ -10537,5 +10537,5 @@
 
 
-The building size and location can be specified with the parameters <a href="#building_height">building_height</a>, <a href="#building_length_x">building_length_x</a>, <a href="#building_length_y">building_length_y</a>, <a href="#building_wall_left">building_wall_left</a> and <a href="#building_wall_south">building_wall_south</a>.</div>
+The building size and location can be specified with the parameters <a href="#building_height">building_height</a>, <a href="#building_length_x">building_length_x</a>, <a href="#building_length_y">building_length_y</a>, <a href="#building_wall_left">building_wall_left</a> and <a href="#building_wall_south">building_wall_south</a>.<br><font color="#000000">Due to the staggered grid the building will be displaced by -0.5 <a href="chapter_4.1.html#dx">dx</a> in x-direction and -0.5 <a href="chapter_4.1.html#dy">dy</a> in y-direction.</font></div>
 
 
@@ -10574,5 +10574,5 @@
 information</font></font><font color="#000000">
 in m. These data&nbsp;<span style="font-style: italic;"></span>must
-exactly match the horizontal grid.</font> </div>
+exactly match the horizontal grid.<br>Due to the staggered grid the topography will be displaced by -0.5 <a href="#dx">dx</a> in x-direction and -0.5 <a href="#dy">dy</a> in y-direction.</font> </div>
 
 
@@ -10586,5 +10586,5 @@
  </span><font color="#000000">
 Alternatively, the user may add code to the user interface subroutine <a href="chapter_3.5.1.html#user_init_grid">user_init_grid</a>
-to allow further topography modes.<br>
+to allow further topography modes. Again, </font><font color="#000000">due to the staggered grid the topography will be displaced by -0.5 <a href="chapter_4.1.html#dx">dx</a> in x-direction and -0.5 <a href="chapter_4.1.html#dy">dy</a> in y-direction.</font><br><font color="#000000">
 
 
Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 133)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 134)
@@ -21,4 +21,9 @@
 -------
 
+Redefine initial nzb_local as the actual total size of topography (later the 
+extent of topography in nzb_local is reduced by 1dx at the E topography walls 
+and by 1dy at the N topography walls to form the basis for nzb_s_inner); 
+for consistency redefine 'single_building' case.
+
 Vertical profiles now based on nzb_s_inner; they are divided by
 ngp_2dh_s_inner (scalars, procucts of scalars) and ngp_2dh (staggered velocity
@@ -40,5 +45,5 @@
 humidity/scalar/salinity in a future release.
 
-buoyancy, check_open, data_output_dvrp, diffusion_s, diffusivities, flow_statistics, header, init_3d_model, init_dvrp, modules, prognostic_equations
+buoyancy, check_open, data_output_dvrp, diffusion_s, diffusivities, flow_statistics, header, init_3d_model, init_dvrp, init_grid, modules, prognostic_equations
 
 
Index: palm/trunk/SOURCE/init_grid.f90
===================================================================
--- palm/trunk/SOURCE/init_grid.f90	(revision 133)
+++ palm/trunk/SOURCE/init_grid.f90	(revision 134)
@@ -4,4 +4,8 @@
 ! Actual revisions:
 ! -----------------
+! Redefine initial nzb_local as the actual total size of topography (later the 
+! extent of topography in nzb_local is reduced by 1dx at the E topography walls 
+! and by 1dy at the N topography walls to form the basis for nzb_s_inner); 
+! for consistency redefine 'single_building' case.
 ! Calculation of wall flag arrays
 !
@@ -365,13 +369,9 @@
 
 !
-!--       Set the individual index arrays for all velocity components and
-!--       scalars, taking into account the staggered grid. The horizontal
-!--       wind component normal to a wall defines the position of the wall, and
-!--       in the respective direction the building is as long as specified in
-!--       building_length_?, but in the other horizontal direction (for w and s
-!--       in both horizontal directions) the building appears shortened by one
-!--       grid length due to the staggered grid.
+!--       Set the actual total size of the building. Due to the staggered grid,
+!--       the building will be displaced by -0.5dx in x-direction and by -0.5dy
+!--       in y-direction compared to the scalar grid.
           nzb_local = 0
-          nzb_local(bys:byn-1,bxl:bxr-1) = bh
+          nzb_local(bys:byn,bxl:bxr) = bh
 
        CASE ( 'read_from_file' )
@@ -468,4 +468,27 @@
           ENDIF
        ENDIF
+
+! 
+!--    The array nzb_local as defined above describes the actual total size of
+!--    topography which is defined by u=0 on the topography walls in x-direction
+!--    and by v=0 on the topography walls in y-direction. However, PALM uses
+!--    individual arrays nzb_u|v|w|s_inner|outer that are based on nzb_s_inner.
+!--    Therefore, the extent of topography in nzb_local is now reduced by 1dx 
+!--    at the E topography walls and by 1dy at the N topography walls to form 
+!--    the basis for nzb_s_inner.
+       DO  j = -gls, ny + gls
+          DO  i = -gls, nx
+             nzb_local(j,i) = MIN( nzb_local(j,i), nzb_local(j,i+1) )
+          ENDDO
+       ENDDO
+!--    apply cyclic boundary conditions in x-direction
+       nzb_local(:,nx+1:nx+gls) = nzb_local(:,0:gls-1)
+       DO  i = -gls, nx + gls
+          DO  j = -gls, ny
+             nzb_local(j,i) = MIN( nzb_local(j,i), nzb_local(j+1,i) )
+          ENDDO
+       ENDDO
+!--    apply cyclic boundary conditions in y-direction
+       nzb_local(ny+1:ny+gls,:) = nzb_local(0:gls-1,:)
 
 !
