Index: palm/trunk/SOURCE/nesting_offl_mod.f90
===================================================================
--- palm/trunk/SOURCE/nesting_offl_mod.f90	(revision 4560)
+++ palm/trunk/SOURCE/nesting_offl_mod.f90	(revision 4561)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-! 
+! Adapt mass-flux correction also for the anelastic approximation
 ! 
 ! Former revisions:
@@ -138,4 +138,5 @@
         ONLY:  dzw,                                                            &
                e,                                                              &
+               drho_air_zw,                                                    &
                diss,                                                           &
                pt,                                                             &
@@ -145,4 +146,6 @@
                rdf,                                                            &
                rdf_sc,                                                         &
+               rho_air,                                                        &
+               rho_air_zw,                                                     &
                s,                                                              &
                u,                                                              &
@@ -872,6 +875,7 @@
              DO  k = nzb+1, nzt
                 volume_flow_l(1) = volume_flow_l(1) + u(k,j,i) * dzw(k) * dy   &
+                                                               * rho_air(k)    &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                       BTEST( wall_flags_total_0(k,j,i), 1 ) )
+                                              BTEST( wall_flags_total_0(k,j,i), 1 ) )
              ENDDO
           ENDDO
@@ -882,6 +886,7 @@
              DO  k = nzb+1, nzt
                 volume_flow_l(1) = volume_flow_l(1) - u(k,j,i) * dzw(k) * dy   &
+                                                               * rho_air(k)    &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                       BTEST( wall_flags_total_0(k,j,i), 1 ) )
+                                              BTEST( wall_flags_total_0(k,j,i), 1 ) )
              ENDDO
           ENDDO
@@ -892,6 +897,7 @@
              DO  k = nzb+1, nzt
                 volume_flow_l(2) = volume_flow_l(2) + v(k,j,i) * dzw(k) * dx   &
+                                                               * rho_air(k)    &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                       BTEST( wall_flags_total_0(k,j,i), 2 ) )
+                                              BTEST( wall_flags_total_0(k,j,i), 2 ) )
              ENDDO
           ENDDO
@@ -902,6 +908,7 @@
              DO  k = nzb+1, nzt
                 volume_flow_l(2) = volume_flow_l(2) - v(k,j,i) * dzw(k) * dx   &
+                                                               * rho_air(k)    &
                                      * MERGE( 1.0_wp, 0.0_wp,                  &
-                                       BTEST( wall_flags_total_0(k,j,i), 2 ) )
+                                              BTEST( wall_flags_total_0(k,j,i), 2 ) )
              ENDDO
           ENDDO
@@ -912,5 +919,5 @@
        DO  i = nxl, nxr
           DO  j = nys, nyn
-             volume_flow_l(3) = volume_flow_l(3) - w(k,j,i) * dx * dy
+             volume_flow_l(3) = volume_flow_l(3) - rho_air_zw(k) * w(k,j,i) * dx * dy
           ENDDO
        ENDDO
@@ -924,10 +931,12 @@
 #endif
 
-       w_correct = SUM( volume_flow ) * d_area_t
+       w_correct = SUM( volume_flow ) * d_area_t * drho_air_zw(nzt)
 
        DO  i = nxl, nxr
           DO  j = nys, nyn
              DO  k = nzt, nzt + 1
-                w(k,j,i) = w(k,j,i) + w_correct
+                w(k,j,i) = w(k,j,i) + w_correct                                &
+                                    * MERGE( 1.0_wp, 0.0_wp,                   &
+                                             BTEST( wall_flags_total_0(k,j,i), 3 ) )
              ENDDO
           ENDDO
