Index: palm/trunk/SOURCE/header.f90
===================================================================
--- palm/trunk/SOURCE/header.f90	(revision 1483)
+++ palm/trunk/SOURCE/header.f90	(revision 1484)
@@ -20,5 +20,12 @@
 ! Current revisions:
 ! -----------------
-! 
+! Changes due to new module structure of the plant canopy model:
+!   module plant_canopy_model_mod and output for new canopy model parameters 
+!   (alpha_lad, beta_lad, lai_beta,...) added,
+!   drag_coefficient, leaf_surface_concentration and scalar_exchange_coefficient
+!   renamed to canopy_drag_coeff, leaf_surface_conc and leaf_scalar_exch_coeff,
+!   learde renamed leaf_area_density.
+! Bugfix: DO-WHILE-loop for lad header information additionally restricted 
+! by maximum number of gradient levels (currently 10)
 !
 ! Former revisions:
@@ -165,5 +172,5 @@
 
     USE arrays_3d,                                                             &
-        ONLY:  lad, pt_init, qsws, q_init, sa_init, shf, ug, vg, w_subs, zu
+        ONLY:  pt_init, qsws, q_init, sa_init, shf, ug, vg, w_subs, zu
         
     USE control_parameters
@@ -205,4 +212,11 @@
         
     USE pegrid
+
+    USE plant_canopy_model_mod,                                                &
+        ONLY:  alpha_lad, beta_lad, calc_beta_lad_profile, canopy_drag_coeff,  &
+               canopy_mode, cthf, lad, lad_surface, lad_vertical_gradient,     &
+               lad_vertical_gradient_level, lad_vertical_gradient_level_ind,   &
+               lai_beta, leaf_scalar_exch_coeff, leaf_surface_conc, pch_index, &
+               plant_canopy
     
     USE spectrum,                                                              &
@@ -242,5 +256,5 @@
     CHARACTER (LEN=86) ::  coordinates         !:
     CHARACTER (LEN=86) ::  gradients           !:
-    CHARACTER (LEN=86) ::  learde              !:
+    CHARACTER (LEN=86) ::  leaf_area_density   !:
     CHARACTER (LEN=86) ::  slices              !:
     CHARACTER (LEN=86) ::  temperatures        !:
@@ -270,8 +284,10 @@
     INTEGER(iwp) ::  io        !:
     INTEGER(iwp) ::  j         !:
+    INTEGER(iwp) ::  k         !:
     INTEGER(iwp) ::  l         !:
     INTEGER(iwp) ::  ll        !:
     INTEGER(iwp) ::  mpi_type  !:
     
+    REAL(wp) ::  canopy_height                    !: canopy height (in m)
     REAL(wp) ::  cpuseconds_per_simulated_second  !:
 
@@ -760,44 +776,71 @@
 
     IF ( plant_canopy )  THEN
-
-       WRITE ( io, 280 ) canopy_mode, pch_index, drag_coefficient
+    
+       canopy_height = pch_index * dz
+
+       WRITE ( io, 280 )  canopy_mode, canopy_height, pch_index,               &
+                          canopy_drag_coeff
        IF ( passive_scalar )  THEN
-          WRITE ( io, 281 ) scalar_exchange_coefficient,   &
-                            leaf_surface_concentration
+          WRITE ( io, 281 )  leaf_scalar_exch_coeff,                           &
+                             leaf_surface_conc
        ENDIF
 
 !
 !--    Heat flux at the top of vegetation
-       WRITE ( io, 282 ) cthf
-
-!
-!--    Leaf area density profile
-!--    Building output strings, starting with surface value
-       WRITE ( learde, '(F6.4)' )  lad_surface
-       gradients = '------'
-       slices = '     0'
-       coordinates = '   0.0'
-       i = 1
-       DO  WHILE ( lad_vertical_gradient_level_ind(i) /= -9999 )
-
-          WRITE (coor_chr,'(F7.2)')  lad(lad_vertical_gradient_level_ind(i))
-          learde = TRIM( learde ) // ' ' // TRIM( coor_chr )
-
-          WRITE (coor_chr,'(F7.2)')  lad_vertical_gradient(i)
-          gradients = TRIM( gradients ) // ' ' // TRIM( coor_chr )
-
-          WRITE (coor_chr,'(I7)')  lad_vertical_gradient_level_ind(i)
-          slices = TRIM( slices ) // ' ' // TRIM( coor_chr )
-
-          WRITE (coor_chr,'(F7.1)')  lad_vertical_gradient_level(i)
-          coordinates = TRIM( coordinates ) // ' '  // TRIM( coor_chr )
-
-          i = i + 1
-       ENDDO
-
-       WRITE ( io, 283 )  TRIM( coordinates ), TRIM( learde ), &
-                          TRIM( gradients ), TRIM( slices )
-
-    ENDIF
+       WRITE ( io, 282 )  cthf
+
+!
+!--    Leaf area density profile, calculated either from given vertical 
+!--    gradients or from beta probability density function.
+       IF (  .NOT.  calc_beta_lad_profile )  THEN
+
+!--       Building output strings, starting with surface value
+          WRITE ( leaf_area_density, '(F6.4)' )  lad_surface
+          gradients = '------'
+          slices = '     0'
+          coordinates = '   0.0'
+          i = 1
+          DO  WHILE ( i < 11  .AND.  lad_vertical_gradient_level_ind(i) /= -9999 )
+
+             WRITE (coor_chr,'(F7.2)')  lad(lad_vertical_gradient_level_ind(i))
+             leaf_area_density = TRIM( leaf_area_density ) // ' ' // TRIM( coor_chr )
+ 
+             WRITE (coor_chr,'(F7.2)')  lad_vertical_gradient(i)
+             gradients = TRIM( gradients ) // ' ' // TRIM( coor_chr )
+
+             WRITE (coor_chr,'(I7)')  lad_vertical_gradient_level_ind(i)
+             slices = TRIM( slices ) // ' ' // TRIM( coor_chr )
+
+             WRITE (coor_chr,'(F7.1)')  lad_vertical_gradient_level(i)
+             coordinates = TRIM( coordinates ) // ' '  // TRIM( coor_chr )
+
+             i = i + 1
+          ENDDO
+
+          WRITE ( io, 283 )  TRIM( coordinates ), TRIM( leaf_area_density ),              &
+                             TRIM( gradients ), TRIM( slices )
+
+       ELSE
+       
+          WRITE ( leaf_area_density, '(F6.4)' )  lad_surface
+          coordinates = '   0.0'
+          
+          DO  k = 1, pch_index
+
+             WRITE (coor_chr,'(F7.2)')  lad(k)
+             leaf_area_density = TRIM( leaf_area_density ) // ' ' // TRIM( coor_chr )
+ 
+             WRITE (coor_chr,'(F7.1)')  zu(k)
+             coordinates = TRIM( coordinates ) // ' '  // TRIM( coor_chr )
+
+          ENDDO       
+
+          WRITE ( io, 284 ) TRIM( coordinates ), TRIM( leaf_area_density ), alpha_lad,    &
+                            beta_lad, lai_beta
+
+       ENDIF  
+
+    ENDIF
+
 
 !
@@ -1836,7 +1879,7 @@
               ' ------------------------------'// &
               ' Canopy mode: ', A / &
-              ' Canopy top: ',I4 / &
+              ' Canopy height: ',F6.2,'m (',I4,' grid points)' / &
               ' Leaf drag coefficient: ',F6.2 /)
-281 FORMAT (/ ' Scalar_exchange_coefficient: ',F6.2 / &
+281 FORMAT (/ ' Scalar exchange coefficient: ',F6.2 / &
               ' Scalar concentration at leaf surfaces in kg/m**3: ',F6.2 /)
 282 FORMAT (' Predefined constant heatflux at the top of the vegetation: ',F6.2,' K m/s')
@@ -1846,4 +1889,10 @@
               ' Gradient:            ',A,'  m**2/m**4'/ &
               ' Gridpoint:           ',A)
+284 FORMAT (//' Characteristic levels of the leaf area density and coefficients:'// &
+              ' Height:              ',A,'  m'/ &
+              ' Leaf area density:   ',A,'  m**2/m**3'/ &
+              ' Coefficient alpha: ',F6.2 / &
+              ' Coefficient beta: ',F6.2 / &
+              ' Leaf area index: ',F6.2,'  m**2/m**2' /)
                
 300 FORMAT (//' Boundary conditions:'/ &
