Index: palm/trunk/UTIL/combine_plot_fields.f90
===================================================================
--- palm/trunk/UTIL/combine_plot_fields.f90	(revision 1469)
+++ palm/trunk/UTIL/combine_plot_fields.f90	(revision 1551)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! Adjustments for data output of soil model quantities
 ! 
 ! Former revisions:
@@ -91,5 +91,5 @@
     CHARACTER (LEN=2)    ::  modus, model_string
     CHARACTER (LEN=6)    ::  id_string
-    CHARACTER (LEN=10)   ::  dimname, var_name
+    CHARACTER (LEN=20)   ::  dimname, var_name
     CHARACTER (LEN=40)   ::  filename
 
@@ -100,6 +100,7 @@
     INTEGER(iwp) ::  av, danz, i, id, j, k, model, models, nc_stat,            &
                      nxa, nxag, nxe, nxeg, nya, nyag, nye, nyeg,               &
-                     nza, nzag, nze, nzeg, pos, time_step,                     &
-                     xa, xe, xxa, xxe, ya, ye, yya, yye, za, ze, zza, zze
+                     nza, nze, pos, time_step,                                 &
+                     xa, xe, xxa, xxe, ya, ya_do, ya_tot, ye, ye_do, ye_tot, yya, yye, za,   &
+                     ze, zza, zze
 
 #if defined( __lc ) || defined( __decalpha )
@@ -372,5 +373,5 @@
 !--                concerning the lower and upper indices of the total-domain
 !--                used in PALM (nxag, nxeg, nyag, nyeg) and the lower and
-!--                upper indices of the array to be writte by this routine
+!--                upper indices of the array to be written by this routine
 !--                (nxa, nxe, nya, nye). Usually in the horizontal directions
 !--                nxag=-1 and nxa=0 while all other variables have the same
@@ -385,4 +386,10 @@
                       READ ( id+110 )  dx, eta, hu, ho
 
+
+!
+!--                   Set actual domain bounds to total domain
+                      ya_do = nya
+                      ye_do = nye
+
                       IF ( iso2d_output )  THEN
                          OPEN ( 2, FILE='PLOT2D_'//modus//TRIM( model_string ),&
@@ -405,5 +412,6 @@
 !
 !--                Read subdomain indices
-                   READ ( id+110, END=998 )  xa, xe, ya, ye
+                   READ ( id+110, END=998 )  xa, xe, ya, ye, ya_tot, ye_tot
+
 !
 !--                IF the PE made no output (in case that no part of the
@@ -412,9 +420,23 @@
                    IF ( .NOT. ( xa == -1  .AND.  xe == -1  .AND. &
                                 ya == -1  .AND.  ye == -1 ) )  THEN
+
+
 !
 !--                   Read the subdomain grid-point values
                       ALLOCATE( pf_tmp(xa:xe,ya:ye) )
                       READ ( id+110 )  pf_tmp
-                      pf(xa:xe,ya:ye) = pf_tmp
+!
+!--                   Calculate indices on atmospheric grid (e.g. for soil model
+!--                   quantities)
+                      IF ( ya /= ya_tot .OR. ye /= ye_tot )  THEN
+                         ye_do = ye - ya
+                         ya_do = ya
+                         pf(xa:xe,ya_do:ye_do) = pf_tmp
+                      ELSE
+                         ye_do = nye
+                         ya_do = nya
+                         pf(xa:xe,ya:ye) = pf_tmp
+                      ENDIF
+
                       DEALLOCATE( pf_tmp )
                    ENDIF
@@ -459,7 +481,7 @@
                          nc_stat = NF90_PUT_VAR( id_set(av),                   &
                                            id_var(av,current_var(av)),         &
-                                           pf(nxa:nxe,nya:nye),                &
+                                           pf(nxa:nxe,ya_do:ye_do),            &
                              start = (/ 1, current_level(av), 1, time_step /), &
-                                      count = (/ nxe-nxa+1, 1, nye-nya+1, 1 /) )
+                                      count = (/ nxe-nxa+1, 1, ye_do-ya_do+1, 1 /) )
                          IF ( nc_stat /= NF90_NOERR )  THEN
                             CALL handle_netcdf_error( 9 )
@@ -469,7 +491,7 @@
                          nc_stat = NF90_PUT_VAR( id_set(av),                   &
                                            id_var(av,current_var(av)),         &
-                                           pf(nxa:nxe,nya:nye),                &
+                                           pf(nxa:nxe,ya_do:ye_do),            &
                              start = (/ current_level(av), 1, 1, time_step /), &
-                                      count = (/ 1, nxe-nxa+1, nye-nya+1, 1 /) )
+                                      count = (/ 1, nxe-nxa+1, ye_do-ya_do+1, 1 /) )
                          IF ( nc_stat /= NF90_NOERR )  THEN
                             CALL handle_netcdf_error( 10 )
@@ -743,11 +765,11 @@
 !--             File from PE0 contains special information at the beginning,
 !--             concerning the lower and upper indices of the total-domain used
-!--             in PALM (nxag, nxeg, nyag, nyeg, nzag, nzeg) and the lower and
+!--             in PALM (nxag, nxeg, nyag, nyeg) and the lower and
 !--             upper indices of the array to be written by this routine (nxa,
 !--             nxe, nya, nye, nza, nze). Usually nxag=-1 and nxa=0, nyag=-1
-!--             and nya=0, nzeg=nz and nze=nz_plot3d.
+!--             and nya=0, nzeg=nz and nze=nz_do3d.
 !--             Allocate necessary array and open the output file.
                 IF ( id == 0  .AND.  fanz(0) == 0  .AND.  fanz(1) == 0 )  THEN
-                   READ ( id+110 )  nxag, nxeg, nyag, nyeg, nzag, nzeg
+                   READ ( id+110 )  nxag, nxeg, nyag, nyeg
                    READ ( id+110 )  nxa, nxe, nya, nye, nza, nze
                    ALLOCATE ( pf3d(nxa:nxe,nya:nye,nza:nze) )
@@ -781,7 +803,5 @@
                 yya = MAX( nya, ya )
                 yye = MIN( nye, ye )
-                zza = MAX( nza, za )
-                zze = MIN( nze, ze )
-                DO  k = zza, zze
+                DO  k = za, ze
                    DO  j = yya, yye
                       DO  i = xxa, xxe
@@ -818,6 +838,6 @@
 !--             Now write the data
                 nc_stat = NF90_PUT_VAR( id_set(av), id_var(av,current_var(av)),&
-                                        pf3d, start = (/ 1, 1, 1, time_step /),&
-                              count = (/ nxe-nxa+1, nye-nya+1, nze-nza+1, 1 /) )
+                                        pf3d(nxa:nxe,nya:nye,za:ze), start = (/ 1, 1, 1, time_step /),&
+                              count = (/ nxe-nxa+1, nye-nya+1, ze-za+1, 1 /) )
                 IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 18 )
 
