Ignore:
Timestamp:
Mar 9, 2020 7:12:57 PM (4 years ago)
Author:
suehring
Message:

Bugfix, missing from_file check for a variable from static input file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/land_surface_model_mod.f90

    r4444 r4450  
    2525! -----------------
    2626! $Id$
     27! Missing from_file check
     28!
     29! 4444 2020-03-05 15:59:50Z raasch
    2730! bugfix: cpp-directive moved
    28 ! 
     31!
    2932! 4442 2020-03-04 19:21:13Z suehring
    30 ! Change order of dimension in surface arrays %frac, %emissivity and %albedo 
     33! Change order of dimension in surface arrays %frac, %emissivity and %albedo
    3134! to allow for better vectorization in the radiation interactions.
    32 ! 
     35!
    3336! 4441 2020-03-04 19:20:35Z suehring
    3437! bugfix: missing cpp-directives for serial mode added, misplaced cpp-directives moved
    35 ! 
     38!
    3639! 4381 2020-01-20 13:51:46Z suehring
    37 ! - Bugfix in nested soil initialization in case no dynamic input file is 
     40! - Bugfix in nested soil initialization in case no dynamic input file is
    3841!   present
    39 ! - In order to do not mess-up the job-protocoll, give error messages 503, 507 
     42! - In order to do not mess-up the job-protocoll, give error messages 503, 507
    4043!   and 508 only once
    41 ! 
     44!
    4245! 4360 2020-01-07 11:25:50Z suehring
    4346! Fix wrong location string in message call
    44 ! 
     47!
    4548! 4356 2019-12-20 17:09:33Z suehring
    4649! Correct single message calls, local checks must be given by the respective
    4750! mpi rank.
    48 ! 
     51!
    4952! 4339 2019-12-13 18:18:30Z suehring
    5053! Bugfix, character length too short, caused crash on NEC.
    51 ! 
     54!
    5255! 4338 2019-12-13 13:23:23Z suehring
    53 ! To avoid divisions by zero, add security factor in calculation of roughness 
     56! To avoid divisions by zero, add security factor in calculation of roughness
    5457! length over water surfaces.
    55 ! 
     58!
    5659! 4321 2019-12-04 10:26:38Z pavelkrc
    5760! Initialization of relative surface fractions revised
    58 ! 
     61!
    5962! 4312 2019-11-27 14:06:25Z suehring
    6063! Bugfix: partitioning of LE from liquid water reservoir fixed. Bare soils are
    6164! now allowed to store liquid water at the surface.
    62 ! 
     65!
    6366! 4261 2019-10-09 17:58:00Z scharf
    6467! bugfix for rev. 4258: deallocate temporary arrays
    65 ! 
     68!
    6669! 4258 2019-10-07 13:29:08Z suehring
    67 ! - Revise limitation for soil moisture in case it exceeds its saturation 
     70! - Revise limitation for soil moisture in case it exceeds its saturation
    6871!   value (J. Resler)
    69 ! - Revise initialization of soil moisture and temperature in a nested run in 
    70 !   case dynamic input information is available. This case, the soil within 
     72! - Revise initialization of soil moisture and temperature in a nested run in
     73!   case dynamic input information is available. This case, the soil within
    7174!   the child domains can be initialized separately. (J. Resler, M. Suehring)
    72 ! - As part of this revision, migrate the netcdf input of soil temperature / 
    73 !   moisture to this module, as well as the routine to inter/extrapolate soil 
    74 !   profiles between different grids. 
    75 ! 
     75! - As part of this revision, migrate the netcdf input of soil temperature /
     76!   moisture to this module, as well as the routine to inter/extrapolate soil
     77!   profiles between different grids.
     78!
    7679! 4251 2019-10-02 12:07:38Z maronga
    7780! Bugfix: albedo_types for vegetation_type look-up table corrected.
    78 ! 
     81!
    7982! 4201 2019-08-29 15:47:27Z suehring
    80 ! - Limit soil moisture to its saturation moisture and give a respective 
     83! - Limit soil moisture to its saturation moisture and give a respective
    8184!   warning rather than an error.
    8285! - Perform checks for soil temperature only when there is no dynamic input
    83 !   file for the parent or possible child domains. 
    84 ! 
     86!   file for the parent or possible child domains.
     87!
    8588! 4194 2019-08-28 08:09:44Z suehring
    86 ! Apply more strict limitation of z0 over water surfaces in case it exceeds the 
    87 ! surface-layer height, in order to avoid instabilities. 
    88 ! 
     89! Apply more strict limitation of z0 over water surfaces in case it exceeds the
     90! surface-layer height, in order to avoid instabilities.
     91!
    8992! 4188 2019-08-26 14:15:47Z suehring
    9093! Minor adjustment in error numbers, typos corrected
    91 ! 
     94!
    9295! 4187 2019-08-26 12:43:15Z suehring
    9396! Adjust message call in case of local checks
    94 ! 
     97!
    9598! 4182 2019-08-22 15:20:23Z scharf
    9699! Corrected "Former revisions" section
    97 ! 
     100!
    98101! 4118 2019-07-25 16:11:45Z suehring
    99102! Initialization of soil temperature and moisture via dynamic input file only
    100 ! for vegetation and pavement surfaces. 
    101 ! 
     103! for vegetation and pavement surfaces.
     104!
    102105! 4110 2019-07-22 17:05:21Z suehring
    103 ! Relax checks for non-consistent initialization in case static or dynamic 
     106! Relax checks for non-consistent initialization in case static or dynamic
    104107! input is provided. For example, soil_temperature or deep_soil_temperature
    105 ! is not mandatory any more if dynamic input is available. Also, improper 
    106 ! settings of x_type in namelist are only checked if no static file is 
    107 ! available. 
    108 ! 
     108! is not mandatory any more if dynamic input is available. Also, improper
     109! settings of x_type in namelist are only checked if no static file is
     110! available.
     111!
    109112! 4109 2019-07-22 17:00:34Z suehring
    110 ! Further revision of last commit in order to avoid any side effects when 
    111 ! albedo type is not set in namelist and default albedo type changes. 
    112 ! 
     113! Further revision of last commit in order to avoid any side effects when
     114! albedo type is not set in namelist and default albedo type changes.
     115!
    113116! 4024 2019-06-12 14:06:46Z suehring
    114117! Bugfix in albedo initialization, caused crashes in rrtmg calls
    115 ! 
     118!
    116119! 3987 2019-05-22 09:52:13Z kanani
    117120! Introduce alternative switch for debug output during timestepping
    118 ! 
     121!
    119122! 3964 2019-05-09 09:48:32Z suehring
    120 ! In a nested child domain, distinguish between soil moisture and temperature 
     123! In a nested child domain, distinguish between soil moisture and temperature
    121124! initialization from parent via dynamic input file. Further, initialize soil
    122125! moisture/temperature from dynamic input file only when initialization via
    123126! 'inifor' is desired.
    124 ! 
     127!
    125128! 3943 2019-05-02 09:50:41Z maronga
    126129! Removed extra blank character
    127 ! 
     130!
    128131! 3941 2019-04-30 09:48:33Z suehring
    129132! Check that at least one surface type is set at surface element.
    130 ! 
     133!
    131134! 3933 2019-04-25 12:33:20Z kanani
    132135! Remove unused subroutine and allocation of pt_2m, this is done in surface_mod
    133136! now (surfaces%pt_2m)
    134 ! 
    135 ! 
    136 ! Changes related to global restructuring of location messages and introduction 
     137!
     138!
     139! Changes related to global restructuring of location messages and introduction
    137140! of additional debug messages
    138 ! 
     141!
    139142! 3881 2019-04-10 09:31:22Z suehring
    140 ! Bugfix in level 3 initialization of pavement albedo type and pavement 
     143! Bugfix in level 3 initialization of pavement albedo type and pavement
    141144! emissivity
    142 ! 
     145!
    143146! 3868 2019-04-08 11:52:36Z suehring
    144 ! More strict limitation of roughness length when it is in the order of the 
    145 ! vertical grid spacing 
    146 ! 
     147! More strict limitation of roughness length when it is in the order of the
     148! vertical grid spacing
     149!
    147150! 3856 2019-04-03 11:06:59Z suehring
    148151! Bugfix in lsm_init in case no surface-fractions are provided
    149 ! 
     152!
    150153! 3847 2019-04-01 14:51:44Z suehring
    151 ! Adjust message-call for checks that are especially carried out locally. 
    152 ! 
     154! Adjust message-call for checks that are especially carried out locally.
     155!
    153156! 3832 2019-03-28 13:16:58Z raasch
    154157! instrumented with openmp directives
    155 ! 
     158!
    156159! 3786 2019-03-06 16:58:03Z raasch
    157160! further unused variables removed
    158 ! 
     161!
    159162! 3767 2019-02-27 08:18:02Z raasch
    160163! unused variable for file index removed from rrd-subroutines parameter list
    161 ! 
     164!
    162165! 3715 2019-02-04 17:34:55Z suehring
    163166! Revise check for saturation moisture
    164 ! 
     167!
    165168! 3710 2019-01-30 18:11:19Z suehring
    166169! Check if soil-, water-, pavement- and vegetation types are set within a valid
    167170! range.
    168 ! 
     171!
    169172! 3692 2019-01-23 14:45:49Z suehring
    170173! Revise check for soil moisture higher than its saturation value
    171 ! 
     174!
    172175! 3685 2019-01-21 01:02:11Z knoop
    173176! Some interface calls moved to module_interface + cleanup
    174 ! 
     177!
    175178! 3677 2019-01-17 09:07:06Z moh.hefny
    176179! Removed most_method
    177 ! 
     180!
    178181! 3655 2019-01-07 16:51:22Z knoop
    179182! nopointer option removed
    180 ! 
     183!
    181184! 1496 2014-12-02 17:25:50Z maronga
    182185! Initial revision
    183 ! 
     186!
    184187!
    185188! Description:
     
    188191!> surface and a multi layer soil scheme. The scheme is similar to the TESSEL
    189192!> scheme implemented in the ECMWF IFS model, with modifications according to
    190 !> H-TESSEL. The implementation is based on the formulation implemented in the 
     193!> H-TESSEL. The implementation is based on the formulation implemented in the
    191194!> DALES and UCLA-LES models.
    192195!>
    193 !> @todo Extensive verification energy-balance solver for vertical surfaces, 
     196!> @todo Extensive verification energy-balance solver for vertical surfaces,
    194197!>       e.g. parametrization of r_a
    195 !> @todo Revise single land-surface processes for vertical surfaces, e.g. 
    196 !>       treatment of humidity, etc. 
    197 !> @todo Consider partial absorption of the net shortwave radiation by the 
     198!> @todo Revise single land-surface processes for vertical surfaces, e.g.
     199!>       treatment of humidity, etc.
     200!> @todo Consider partial absorption of the net shortwave radiation by the
    198201!>       skin layer.
    199202!> @todo Improve surface water parameterization
    200 !> @todo Invert indices (running from -3 to 0. Currently: nzb_soil=0, 
     203!> @todo Invert indices (running from -3 to 0. Currently: nzb_soil=0,
    201204!>       nzt_soil=3)).
    202 !> @todo Implement surface runoff model (required when performing long-term LES 
     205!> @todo Implement surface runoff model (required when performing long-term LES
    203206!>       with considerable precipitation.
    204207!> @todo Revise calculation of f2 when wilting point is non-constant in the
     
    207210!> @note No time step criterion is required as long as the soil layers do not
    208211!>       become too thin.
    209 !> @todo Attention, pavement_subpars_1/2 are hardcoded to 8 levels, in case 
     212!> @todo Attention, pavement_subpars_1/2 are hardcoded to 8 levels, in case
    210213!>       more levels are used this may cause an potential bug
    211214!> @todo Routine calc_q_surface required?
     
    213216!------------------------------------------------------------------------------!
    214217 MODULE land_surface_model_mod
    215  
     218
    216219    USE arrays_3d,                                                             &
    217220        ONLY:  hyp, pt, prr, q, q_p, ql, vpt, u, v, w, hyrho, exner, d_exner
     
    235238               surface_pressure, timestep_scheme, tsc,                         &
    236239               time_since_reference_point
    237                
     240
    238241    USE cpulog,                                                                &
    239242        ONLY:  cpu_log, log_point_s
     
    274277                vegetation_type_f,                                             &
    275278                water_pars_f,                                                  &
    276                 water_type_f             
     279                water_type_f
    277280
    278281    USE kinds
     
    283286        ONLY:  albedo, albedo_type, emissivity, force_radiation_call,          &
    284287               radiation, radiation_scheme, unscheduled_radiation_calls
    285        
     288
    286289    USE statistics,                                                            &
    287290        ONLY:  hom, statistic_regions
     
    303306    REAL(wp), PARAMETER  ::                    &
    304307              b_ch               = 6.04_wp,    & ! Clapp & Hornberger exponent
    305               lambda_h_dry       = 0.19_wp,    & ! heat conductivity for dry soil (W/m/K) 
     308              lambda_h_dry       = 0.19_wp,    & ! heat conductivity for dry soil (W/m/K)
    306309              lambda_h_sm        = 3.44_wp,    & ! heat conductivity of the soil matrix (W/m/K)
    307310              lambda_h_water     = 0.57_wp,    & ! heat conductivity of water (W/m/K)
     
    329332!-- LSM variables
    330333    CHARACTER(10) :: surface_type = 'netcdf'      !< general classification. Allowed are:
    331                                                   !< 'vegetation', 'pavement', ('building'), 
     334                                                  !< 'vegetation', 'pavement', ('building'),
    332335                                                  !< 'water', and 'netcdf'
    333336
     
    339342                    nzs = 8,                  & !< number of soil layers
    340343                    pavement_depth_level = 0, & !< default NAMELIST nzt_pavement
    341                     pavement_type = 1,        & !< default NAMELIST pavement_type                 
     344                    pavement_type = 1,        & !< default NAMELIST pavement_type
    342345                    soil_type = 3,            & !< default NAMELIST soil_type
    343346                    vegetation_type = 2,      & !< default NAMELIST vegetation_type
    344347                    water_type = 1              !< default NAMELISt water_type
    345                    
    346    
    347        
     348
     349
     350
    348351    LOGICAL :: conserve_water_content = .TRUE.,  & !< open or closed bottom surface for the soil model
    349352               constant_roughness = .FALSE.,     & !< use fixed/dynamic roughness lengths for water surfaces
     
    390393                z0_water       = 9999999.9_wp,          & !< NAMELIST z0 (lsm_par)
    391394                z0h_water      = 9999999.9_wp,          & !< NAMELIST z0h (lsm_par)
    392                 z0q_water      = 9999999.9_wp             !< NAMELIST z0q (lsm_par) 
    393                
    394                
     395                z0q_water      = 9999999.9_wp             !< NAMELIST z0q (lsm_par)
     396
     397
    395398    REAL(wp), DIMENSION(:), ALLOCATABLE  :: ddz_soil_center, & !< 1/dz_soil_center
    396399                                            ddz_soil,        & !< 1/dz_soil
     
    400403
    401404
    402                                            
     405
    403406    REAL(wp), DIMENSION(0:20)  ::  root_fraction = 9999999.9_wp,     & !< (NAMELIST) distribution of root surface area to the individual soil layers
    404407                                   soil_moisture = 0.0_wp,           & !< NAMELIST soil moisture content (m3/m3)
     
    406409                                   dz_soil  = 9999999.9_wp,          & !< (NAMELIST) soil layer depths (spacing)
    407410                                   zs_layer = 9999999.9_wp             !< soil layer depths (edge)
    408                                  
     411
    409412    TYPE(surf_type_lsm), POINTER ::  t_soil_h,    & !< Soil temperature (K), horizontal surface elements
    410413                                     t_soil_h_p,  & !< Prog. soil temperature (K), horizontal surface elements
    411414                                     m_soil_h,    & !< Soil moisture (m3/m3), horizontal surface elements
    412                                      m_soil_h_p     !< Prog. soil moisture (m3/m3), horizontal surface elements 
     415                                     m_soil_h_p     !< Prog. soil moisture (m3/m3), horizontal surface elements
    413416
    414417    TYPE(surf_type_lsm), TARGET  ::  t_soil_h_1,  & !<
     
    421424                                     t_soil_v_p,  & !< Prog. soil temperature (K), vertical surface elements
    422425                                     m_soil_v,    & !< Soil moisture (m3/m3), vertical surface elements
    423                                      m_soil_v_p     !< Prog. soil moisture (m3/m3), vertical surface elements   
     426                                     m_soil_v_p     !< Prog. soil moisture (m3/m3), vertical surface elements
    424427
    425428    TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::&
     
    429432                                     m_soil_v_2     !<
    430433
    431     TYPE(surf_type_lsm), POINTER  ::  t_surface_h,    & !< surface temperature (K), horizontal surface elements 
    432                                       t_surface_h_p,  & !< progn. surface temperature (K), horizontal surface elements 
    433                                       m_liq_h,        & !< liquid water reservoir (m), horizontal surface elements 
    434                                       m_liq_h_p         !< progn. liquid water reservoir (m), horizontal surface elements 
     434    TYPE(surf_type_lsm), POINTER  ::  t_surface_h,    & !< surface temperature (K), horizontal surface elements
     435                                      t_surface_h_p,  & !< progn. surface temperature (K), horizontal surface elements
     436                                      m_liq_h,        & !< liquid water reservoir (m), horizontal surface elements
     437                                      m_liq_h_p         !< progn. liquid water reservoir (m), horizontal surface elements
    435438
    436439    TYPE(surf_type_lsm), TARGET   ::  t_surface_h_1,  & !<
     
    440443
    441444    TYPE(surf_type_lsm), DIMENSION(:), POINTER  ::    &
    442                                       t_surface_v,    & !< surface temperature (K), vertical surface elements 
    443                                       t_surface_v_p,  & !< progn. surface temperature (K), vertical surface elements 
    444                                       m_liq_v,        & !< liquid water reservoir (m), vertical surface elements 
    445                                       m_liq_v_p         !< progn. liquid water reservoir (m), vertical surface elements 
     445                                      t_surface_v,    & !< surface temperature (K), vertical surface elements
     446                                      t_surface_v_p,  & !< progn. surface temperature (K), vertical surface elements
     447                                      m_liq_v,        & !< liquid water reservoir (m), vertical surface elements
     448                                      m_liq_v_p         !< progn. liquid water reservoir (m), vertical surface elements
    446449
    447450    TYPE(surf_type_lsm), DIMENSION(0:3), TARGET   ::  &
     
    456459                                                        m_soil_av    !< Average of m_soil
    457460
    458     TYPE(surf_type_lsm), TARGET ::  tm_liq_h_m      !< liquid water reservoir tendency (m), horizontal surface elements 
    459     TYPE(surf_type_lsm), TARGET ::  tt_surface_h_m  !< surface temperature tendency (K), horizontal surface elements 
    460     TYPE(surf_type_lsm), TARGET ::  tt_soil_h_m     !< t_soil storage array, horizontal surface elements 
    461     TYPE(surf_type_lsm), TARGET ::  tm_soil_h_m     !< m_soil storage array, horizontal surface elements 
    462 
    463     TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::  tm_liq_v_m      !< liquid water reservoir tendency (m), vertical surface elements 
    464     TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::  tt_surface_v_m  !< surface temperature tendency (K), vertical surface elements 
    465     TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::  tt_soil_v_m     !< t_soil storage array, vertical surface elements 
    466     TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::  tm_soil_v_m     !< m_soil storage array, vertical surface elements 
    467 
    468 !
    469 !-- Energy balance variables               
     461    TYPE(surf_type_lsm), TARGET ::  tm_liq_h_m      !< liquid water reservoir tendency (m), horizontal surface elements
     462    TYPE(surf_type_lsm), TARGET ::  tt_surface_h_m  !< surface temperature tendency (K), horizontal surface elements
     463    TYPE(surf_type_lsm), TARGET ::  tt_soil_h_m     !< t_soil storage array, horizontal surface elements
     464    TYPE(surf_type_lsm), TARGET ::  tm_soil_h_m     !< m_soil storage array, horizontal surface elements
     465
     466    TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::  tm_liq_v_m      !< liquid water reservoir tendency (m), vertical surface elements
     467    TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::  tt_surface_v_m  !< surface temperature tendency (K), vertical surface elements
     468    TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::  tt_soil_v_m     !< t_soil storage array, vertical surface elements
     469    TYPE(surf_type_lsm), DIMENSION(0:3), TARGET ::  tm_soil_v_m     !< m_soil storage array, vertical surface elements
     470
     471!
     472!-- Energy balance variables
    470473    REAL(wp), DIMENSION(:,:), ALLOCATABLE :: &
    471474              c_liq_av,         & !< average of c_liq
    472475              c_soil_av,        & !< average of c_soil
    473476              c_veg_av,         & !< average of c_veg
    474               lai_av,           & !< average of lai       
     477              lai_av,           & !< average of lai
    475478              qsws_liq_av,      & !< average of qsws_liq
    476479              qsws_soil_av,     & !< average of qsws_soil
    477480              qsws_veg_av,      & !< average of qsws_veg
    478481              r_s_av              !< average of r_s
    479  
     482
    480483!
    481484!-- Predefined Land surface classes (vegetation_type)
    482485    CHARACTER(26), DIMENSION(0:18), PARAMETER :: vegetation_type_name = (/ &
    483                                    'user defined              ',           & !  0 
    484                                    'bare soil                 ',           & !  1                           
     486                                   'user defined              ',           & !  0
     487                                   'bare soil                 ',           & !  1
    485488                                   'crops, mixed farming      ',           & !  2
    486489                                   'short grass               ',           & !  3
     
    505508!-- Soil model classes (soil_type)
    506509    CHARACTER(12), DIMENSION(0:6), PARAMETER :: soil_type_name = (/ &
    507                                    'user defined',                  & ! 0 
     510                                   'user defined',                  & ! 0
    508511                                   'coarse      ',                  & ! 1
    509512                                   'medium      ',                  & ! 2
     
    517520!-- Pavement classes
    518521    CHARACTER(29), DIMENSION(0:15), PARAMETER :: pavement_type_name = (/ &
    519                                    'user defined                 ', & ! 0 
     522                                   'user defined                 ', & ! 0
    520523                                   'asphalt/concrete mix         ', & ! 1
    521524                                   'asphalt (asphalt concrete)   ', & ! 2
     
    533536                                   'artifical turf (sports)      ', & ! 14
    534537                                   'clay (sports)                '  & ! 15
    535                                                                  /)                                                             
    536                                                                  
     538                                                                 /)
     539
    537540!
    538541!-- Water classes
    539542    CHARACTER(12), DIMENSION(0:5), PARAMETER :: water_type_name = (/ &
    540                                    'user defined',                   & ! 0 
     543                                   'user defined',                   & ! 0
    541544                                   'lake        ',                   & ! 1
    542545                                   'river       ',                   & ! 2
     
    544547                                   'pond        ',                   & ! 4
    545548                                   'fountain    '                    & ! 5
    546                                                                   /)                                                                                 
    547                    
     549                                                                  /)
     550
    548551!
    549552!-- Land surface parameters according to the respective classes (vegetation_type)
     
    599602                                                               /), (/ 12, 18 /) )
    600603
    601                                    
     604
    602605!
    603606!-- Root distribution for default soil layer configuration (sum = 1)
     
    618621                                 0.00_wp, 0.00_wp, 0.00_wp, 0.00_wp,            & ! 13
    619622                                 0.25_wp, 0.34_wp, 0.27_wp, 0.11_wp,            & ! 14
    620                                  0.23_wp, 0.36_wp, 0.30_wp, 0.11_wp,            & ! 15 
    621                                  0.23_wp, 0.36_wp, 0.30_wp, 0.11_wp,            & ! 16 
     623                                 0.23_wp, 0.36_wp, 0.30_wp, 0.11_wp,            & ! 15
     624                                 0.23_wp, 0.36_wp, 0.30_wp, 0.11_wp,            & ! 16
    622625                                 0.19_wp, 0.35_wp, 0.36_wp, 0.10_wp,            & ! 17
    623626                                 0.19_wp, 0.35_wp, 0.36_wp, 0.10_wp             & ! 18
     
    628631
    629632!
    630 !-- Soil parameters  alpha_vg,      l_vg,    n_vg, gamma_w_sat,    m_sat,     m_fc,   m_wilt,    m_res 
     633!-- Soil parameters  alpha_vg,      l_vg,    n_vg, gamma_w_sat,    m_sat,     m_fc,   m_wilt,    m_res
    631634    REAL(wp), DIMENSION(0:7,1:6), PARAMETER :: soil_pars = RESHAPE( (/     &
    632635                      3.83_wp,  1.250_wp, 1.38_wp,  6.94E-6_wp, 0.403_wp, 0.244_wp, 0.059_wp, 0.025_wp,& ! 1
     
    641644!
    642645!-- TO BE FILLED
    643 !-- Pavement parameters      z0,       z0h, albedo_type, emissivity 
     646!-- Pavement parameters      z0,       z0h, albedo_type, emissivity
    644647    REAL(wp), DIMENSION(0:3,1:15), PARAMETER :: pavement_pars = RESHAPE( (/ &
    645648                      5.0E-2_wp, 5.0E-4_wp,     18.0_wp,    0.97_wp,  & !  1
    646649                      5.0E-2_wp, 5.0E-4_wp,     19.0_wp,    0.94_wp,  & !  2
    647                       1.0E-2_wp, 1.0E-4_wp,     20.0_wp,    0.98_wp,  & !  3                                 
     650                      1.0E-2_wp, 1.0E-4_wp,     20.0_wp,    0.98_wp,  & !  3
    648651                      1.0E-2_wp, 1.0E-4_wp,     21.0_wp,    0.93_wp,  & !  4
    649652                      1.0E-2_wp, 1.0E-4_wp,     22.0_wp,    0.97_wp,  & !  5
     
    651654                      1.0E-2_wp, 1.0E-4_wp,     24.0_wp,    0.97_wp,  & !  7
    652655                      1.0E-2_wp, 1.0E-4_wp,     25.0_wp,    0.94_wp,  & !  8
    653                       1.0E-2_wp, 1.0E-4_wp,     26.0_wp,    0.98_wp,  & !  9                                 
     656                      1.0E-2_wp, 1.0E-4_wp,     26.0_wp,    0.98_wp,  & !  9
    654657                      1.0E-2_wp, 1.0E-4_wp,     27.0_wp,    0.93_wp,  & ! 10
    655658                      1.0E-2_wp, 1.0E-4_wp,     28.0_wp,    0.97_wp,  & ! 11
     
    658661                      1.0E-2_wp, 1.0E-4_wp,     31.0_wp,    0.94_wp,  & ! 14
    659662                      1.0E-2_wp, 1.0E-4_wp,     32.0_wp,    0.98_wp   & ! 15
    660                       /), (/ 4, 15 /) )                             
     663                      /), (/ 4, 15 /) )
    661664!
    662665!-- Pavement subsurface parameters part 1: thermal conductivity (W/m/K)
     
    700703       1.94E6_wp, 1.94E6_wp, 1.94E6_wp, 1.94E6_wp, 1.94E6_wp, 1.94E6_wp, 9999999.9_wp, 9999999.9_wp  & ! 15
    701704                           /), (/ 8, 15 /) )
    702  
     705
    703706!
    704707!-- TO BE FILLED
     
    710713       283.0_wp, 0.01_wp, 0.001_wp, 1.0E10_wp, 1.0E10_wp, 1.0_wp, 0.99_wp, & ! 4
    711714       283.0_wp, 0.01_wp, 0.001_wp, 1.0E10_wp, 1.0E10_wp, 1.0_wp, 0.99_wp  & ! 5
    712                                                                      /), (/ 7, 5 /) )                                                                   
    713                                                                                                                                      
     715                                                                     /), (/ 7, 5 /) )
     716
    714717    SAVE
    715718
     
    717720    PRIVATE
    718721
    719    
     722
    720723!
    721724!-- Public functions
    722725    PUBLIC lsm_boundary_condition, lsm_check_data_output,                      &
    723726           lsm_check_data_output_pr,                                           &
    724            lsm_check_parameters, lsm_define_netcdf_grid, lsm_3d_data_averaging,& 
     727           lsm_check_parameters, lsm_define_netcdf_grid, lsm_3d_data_averaging,&
    725728           lsm_data_output_2d, lsm_data_output_3d, lsm_energy_balance,         &
    726729           lsm_header, lsm_init, lsm_init_arrays, lsm_parin, lsm_soil_model,   &
     
    745748       MODULE PROCEDURE lsm_check_data_output
    746749    END INTERFACE lsm_check_data_output
    747    
     750
    748751    INTERFACE lsm_check_data_output_pr
    749752       MODULE PROCEDURE lsm_check_data_output_pr
    750753    END INTERFACE lsm_check_data_output_pr
    751    
     754
    752755    INTERFACE lsm_check_parameters
    753756       MODULE PROCEDURE lsm_check_parameters
    754757    END INTERFACE lsm_check_parameters
    755    
     758
    756759    INTERFACE lsm_3d_data_averaging
    757760       MODULE PROCEDURE lsm_3d_data_averaging
     
    777780       MODULE PROCEDURE lsm_header
    778781    END INTERFACE lsm_header
    779    
     782
    780783    INTERFACE lsm_init
    781784       MODULE PROCEDURE lsm_init
     
    785788       MODULE PROCEDURE lsm_init_arrays
    786789    END INTERFACE lsm_init_arrays
    787    
     790
    788791    INTERFACE lsm_parin
    789792       MODULE PROCEDURE lsm_parin
    790793    END INTERFACE lsm_parin
    791    
     794
    792795    INTERFACE lsm_soil_model
    793796       MODULE PROCEDURE lsm_soil_model
     
    812815! Description:
    813816! ------------
    814 !> Set internal Neumann boundary condition at outer soil grid points 
    815 !> for temperature and humidity. 
     817!> Set internal Neumann boundary condition at outer soil grid points
     818!> for temperature and humidity.
    816819!------------------------------------------------------------------------------!
    817820 SUBROUTINE lsm_boundary_condition
    818  
     821
    819822    IMPLICIT NONE
    820823
     
    879882!------------------------------------------------------------------------------!
    880883 SUBROUTINE lsm_check_data_output( var, unit, i, ilen, k )
    881  
    882  
     884
     885
    883886    USE control_parameters,                                                    &
    884887        ONLY:  data_output, message_string
     
    886889    IMPLICIT NONE
    887890
    888     CHARACTER (LEN=*) ::  unit  !< 
     891    CHARACTER (LEN=*) ::  unit  !<
    889892    CHARACTER (LEN=*) ::  var   !<
    890893
    891894    INTEGER(iwp) :: i
    892     INTEGER(iwp) :: ilen   
     895    INTEGER(iwp) :: ilen
    893896    INTEGER(iwp) :: k
    894897
     
    902905          ENDIF
    903906          unit = 'm3/m3'
    904            
     907
    905908       CASE ( 't_soil' )
    906909          IF (  .NOT.  land_surface )  THEN
     
    909912             CALL message( 'lsm_check_data_output', 'PA0404', 1, 2, 0, 6, 0 )
    910913          ENDIF
    911           unit = 'K'   
    912              
     914          unit = 'K'
     915
    913916       CASE ( 'lai*', 'c_liq*', 'c_soil*', 'c_veg*', 'm_liq*',                 &
    914917              'qsws_liq*', 'qsws_soil*', 'qsws_veg*', 'r_s*' )
     
    969972          ENDIF
    970973
    971           IF ( TRIM( var ) == 'lai*'   )      unit = 'none' 
     974          IF ( TRIM( var ) == 'lai*'   )      unit = 'none'
    972975          IF ( TRIM( var ) == 'c_liq*' )      unit = 'none'
    973976          IF ( TRIM( var ) == 'c_soil*')      unit = 'none'
     
    977980          IF ( TRIM( var ) == 'qsws_soil*' )  unit = 'W/m2'
    978981          IF ( TRIM( var ) == 'qsws_veg*'  )  unit = 'W/m2'
    979           IF ( TRIM( var ) == 'r_s*')         unit = 's/m' 
    980              
     982          IF ( TRIM( var ) == 'r_s*')         unit = 's/m'
     983
    981984       CASE DEFAULT
    982985          unit = 'illegal'
     
    995998!------------------------------------------------------------------------------!
    996999 SUBROUTINE lsm_check_data_output_pr( variable, var_count, unit, dopr_unit )
    997  
     1000
    9981001    USE control_parameters,                                                    &
    9991002        ONLY:  data_output_pr, message_string
     
    10061009
    10071010    IMPLICIT NONE
    1008    
    1009     CHARACTER (LEN=*) ::  unit      !< 
    1010     CHARACTER (LEN=*) ::  variable  !< 
     1011
     1012    CHARACTER (LEN=*) ::  unit      !<
     1013    CHARACTER (LEN=*) ::  variable  !<
    10111014    CHARACTER (LEN=*) ::  dopr_unit !< local value of dopr_unit
    1012  
    1013     INTEGER(iwp) ::  var_count     !< 
     1015
     1016    INTEGER(iwp) ::  var_count     !<
    10141017
    10151018    SELECT CASE ( TRIM( variable ) )
    1016        
     1019
    10171020       CASE ( 't_soil', '#t_soil' )
    10181021          IF (  .NOT.  land_surface )  THEN
     
    10591062
    10601063 END SUBROUTINE lsm_check_data_output_pr
    1061  
    1062  
     1064
     1065
    10631066!------------------------------------------------------------------------------!
    10641067! Description:
     
    10701073    USE control_parameters,                                                    &
    10711074        ONLY:  bc_pt_b, bc_q_b, constant_flux_layer, message_string
    1072                      
    1073    
     1075
     1076
    10741077    IMPLICIT NONE
    10751078
     
    10771080    INTEGER(iwp) ::  j        !< running index, y-dimension
    10781081    INTEGER(iwp) ::  k        !< running index, z-dimension
    1079    
     1082
    10801083    LOGICAL      ::  dynamic_soil_input_parent !< flag indicating the presence of a dynamic input file for the parent
    10811084
     
    10861089         TRIM( surface_type ) /= 'pavement'    .AND.                           &
    10871090         TRIM( surface_type ) /= 'water'       .AND.                           &
    1088          TRIM( surface_type ) /= 'netcdf' )  THEN 
     1091         TRIM( surface_type ) /= 'netcdf' )  THEN
    10891092       message_string = 'unknown surface type: surface_type = "' //            &
    10901093                        TRIM( surface_type ) // '"'
     
    11081111       CALL message( 'lsm_check_parameters', 'PA0400', 1, 2, 0, 6, 0 )
    11091112    ENDIF
    1110    
     1113
    11111114    IF (  .NOT.  radiation )  THEN
    11121115       message_string = 'lsm requires '//                                      &
     
    11421145    ENDIF
    11431146!
    1144 !-- Check if vegetation types are set within a valid range.   
     1147!-- Check if vegetation types are set within a valid range.
    11451148    IF ( TRIM( surface_type ) == 'vegetation' )  THEN
    11461149       IF ( vegetation_type < LBOUND( vegetation_pars, 2 )  .AND.              &
     
    11621165                                        'the valid range at (j,i) = ', j, i
    11631166                   CALL message( 'lsm_check_parameters', 'PA0526',             &
    1164                                   2, 2, myid, 6, 0 ) 
     1167                                  2, 2, myid, 6, 0 )
    11651168                ENDIF
    11661169             ENDDO
     
    11691172    ENDIF
    11701173!
    1171 !-- Check if pavement types are set within a valid range.   
     1174!-- Check if pavement types are set within a valid range.
    11721175    IF ( TRIM( surface_type ) == 'pavement' )  THEN
    11731176       IF ( pavement_type < LBOUND( pavement_pars, 2 )  .AND.                  &
     
    11881191                                        'the valid range at (j,i) = ', j, i
    11891192                   CALL message( 'lsm_check_parameters', 'PA0527',             &
    1190                                   2, 2, myid, 6, 0 ) 
     1193                                  2, 2, myid, 6, 0 )
    11911194                ENDIF
    11921195             ENDDO
     
    11951198    ENDIF
    11961199!
    1197 !-- Check if water types are set within a valid range.   
     1200!-- Check if water types are set within a valid range.
    11981201    IF ( TRIM( surface_type ) == 'water' )  THEN
    11991202       IF ( water_type < LBOUND( water_pars, 2 )  .AND.                        &
     
    12141217                                        'the valid range at (j,i) = ', j, i
    12151218                   CALL message( 'lsm_check_parameters', 'PA0528',             &
    1216                                  2, 2, myid, 6, 0 ) 
     1219                                 2, 2, myid, 6, 0 )
    12171220                ENDIF
    12181221             ENDDO
     
    12231226!-- Check further settings for consistency.
    12241227    IF ( TRIM( surface_type ) == 'vegetation' )  THEN
    1225    
     1228
    12261229       IF ( vegetation_type == 0 )  THEN
    12271230          IF ( min_canopy_resistance == 9999999.9_wp )  THEN
     
    12971300          ENDIF
    12981301       ENDIF
    1299  
     1302
    13001303    ENDIF
    1301    
     1304
    13021305    IF ( TRIM( surface_type ) == 'water' )  THEN
    13031306
    1304        IF ( water_type == 0 )  THEN 
    1305        
     1307       IF ( water_type == 0 )  THEN
     1308
    13061309          IF ( z0_water == 9999999.9_wp )  THEN
    13071310             message_string = 'water_type = 0 (user_defined)'//                &
     
    13171320             CALL message( 'lsm_check_parameters', 'PA0392', 1, 2, 0, 6, 0 )
    13181321          ENDIF
    1319          
     1322
    13201323          IF ( water_temperature == 9999999.9_wp )  THEN
    13211324             message_string = 'water_type = 0 (user_defined)'//                &
     
    13231326                              '/= 9999999.9'
    13241327             CALL message( 'lsm_check_parameters', 'PA0379', 1, 2, 0, 6, 0 )
    1325           ENDIF       
    1326          
     1328          ENDIF
     1329
    13271330       ENDIF
    1328        
     1331
    13291332    ENDIF
    1330    
     1333
    13311334    IF ( TRIM( surface_type ) == 'pavement' )  THEN
    13321335
     
    13371340       ENDIF
    13381341
    1339        IF ( pavement_type == 0 )  THEN 
    1340        
     1342       IF ( pavement_type == 0 )  THEN
     1343
    13411344          IF ( z0_pavement == 9999999.9_wp )  THEN
    13421345             message_string = 'pavement_type = 0 (user_defined)'//             &
     
    13451348             CALL message( 'lsm_check_parameters', 'PA0352', 1, 2, 0, 6, 0 )
    13461349          ENDIF
    1347          
     1350
    13481351          IF ( z0h_pavement == 9999999.9_wp )  THEN
    13491352             message_string = 'pavement_type = 0 (user_defined)'//             &
     
    13521355             CALL message( 'lsm_check_parameters', 'PA0353', 1, 2, 0, 6, 0 )
    13531356          ENDIF
    1354          
     1357
    13551358          IF ( pavement_heat_conduct == 9999999.9_wp )  THEN
    13561359             message_string = 'pavement_type = 0 (user_defined)'//             &
     
    13581361                              '/= 9999999.9'
    13591362             CALL message( 'lsm_check_parameters', 'PA0342', 1, 2, 0, 6, 0 )
    1360           ENDIF 
    1361          
     1363          ENDIF
     1364
    13621365           IF ( pavement_heat_capacity == 9999999.9_wp )  THEN
    13631366             message_string = 'pavement_type = 0 (user_defined)'//             &
     
    13651368                              '/= 9999999.9'
    13661369             CALL message( 'lsm_check_parameters', 'PA0139', 1, 2, 0, 6, 0 )
    1367           ENDIF 
     1370          ENDIF
    13681371
    13691372          IF ( pavement_depth_level == 0 )  THEN
     
    13721375                              '/= 0'
    13731376             CALL message( 'lsm_check_parameters', 'PA0474', 1, 2, 0, 6, 0 )
    1374           ENDIF 
    1375 
    1376        ENDIF 
    1377    
     1377          ENDIF
     1378
     1379       ENDIF
     1380
    13781381    ENDIF
    13791382
    13801383    IF ( TRIM( surface_type ) == 'netcdf' )  THEN
    1381 !
    1382 !--    MS: Some problme here, after calling message everythings stucks at
    1383 !--        MPI_FINALIZE call.
    1384        IF ( ANY( pavement_type_f%var /= pavement_type_f%fill )  .AND.           &
    1385             ANY( dz_soil /= 9999999.9_wp ) )  THEN
    1386           message_string = 'pavement-surfaces are not allowed in ' //           &
    1387                            'combination with a non-default setting of dz_soil'
    1388           CALL message( 'lsm_check_parameters', 'PA0316', 2, 2, 0, 6, 0 )
     1384       IF ( pavement_type_f%from_file )  THEN
     1385          IF ( ANY( pavement_type_f%var /= pavement_type_f%fill )  .AND.       &
     1386               ANY( dz_soil /= 9999999.9_wp ) )  THEN
     1387             message_string = 'pavement-surfaces are not allowed in ' //       &
     1388                              'combination with a non-default setting of dz_soil'
     1389             CALL message( 'lsm_check_parameters', 'PA0316', 2, 2, 0, 6, 0 )
     1390          ENDIF
    13891391       ENDIF
    13901392    ENDIF
    1391    
     1393
    13921394!
    13931395!-- Temporary message as long as NetCDF input is not available
     
    14571459
    14581460    ENDIF
    1459 
    1460 
    1461 !!! these checks are not needed for water surfaces??
    14621461
    14631462!
     
    14741473             nzt_soil = nzt_soil + 1
    14751474          ENDIF
    1476        ENDDO   
     1475       ENDDO
    14771476    ENDIF
    14781477    nzs = nzt_soil + 1
    14791478
    14801479!
    1481 !-- Check whether valid soil temperatures are prescribed. Only check this if 
     1480!-- Check whether valid soil temperatures are prescribed. Only check this if
    14821481!-- no dynamic soil is not initialized with dynamic input.
    1483 !-- In a nested case, check whether there is a dynamic input file for the 
     1482!-- In a nested case, check whether there is a dynamic input file for the
    14841483!-- child (input_pids_dynamic = .T.) or one for the parent (inquire without
    1485 !-- coupling_char. 
     1484!-- coupling_char.
    14861485    INQUIRE( FILE = TRIM( input_file_dynamic ),                                &
    14871486             EXIST = dynamic_soil_input_parent )
     
    15181517!
    15191518!-- Calculate grid spacings. Temperature and moisture are defined at
    1520 !-- the center of the soil layers, whereas gradients/fluxes are 
     1519!-- the center of the soil layers, whereas gradients/fluxes are
    15211520!-- defined at the edges (_layer)
    15221521!
     
    15381537    dz_soil(nzt_soil+1) = zs_layer(nzt_soil) + dz_soil(nzt_soil)
    15391538    zs(nzt_soil+1) = zs_layer(nzt_soil) + 0.5_wp * dz_soil(nzt_soil)
    1540  
     1539
    15411540    DO  k = nzb_soil, nzt_soil-1
    15421541       dz_soil_center(k) = zs(k+1) - zs(k)
     
    15451544                           '(dz_soil_center(k) <= 0.0)'
    15461545          CALL message( 'lsm_check_parameters', 'PA0140', 1, 2, 0, 6, 0 )
    1547        ENDIF 
     1546       ENDIF
    15481547    ENDDO
    1549  
     1548
    15501549    dz_soil_center(nzt_soil) = zs_layer(k-1) + dz_soil(k) - zs(nzt_soil)
    1551        
     1550
    15521551    ddz_soil_center = 1.0_wp / dz_soil_center
    15531552    ddz_soil(nzb_soil:nzt_soil) = 1.0_wp / dz_soil(nzb_soil:nzt_soil)
     
    15561555
    15571556 END SUBROUTINE lsm_check_parameters
    1558  
     1557
    15591558!------------------------------------------------------------------------------!
    15601559! Description:
     
    16451644
    16461645!
    1647 !-- Index offset of surface element point with respect to adjoining 
    1648 !-- atmospheric grid point 
     1646!-- Index offset of surface element point with respect to adjoining
     1647!-- atmospheric grid point
    16491648    k_off = surf%koff
    16501649    j_off = surf%joff
     
    16581657    DO  m = 1, surf%ns
    16591658
    1660        i   = surf%i(m)           
     1659       i   = surf%i(m)
    16611660       j   = surf%j(m)
    16621661       k   = surf%k(m)
     
    16671666!--    parameterization uses a combination of two conductivities: a constant
    16681667!--    conductivity for the skin layer, and a conductivity according to the
    1669 !--    uppermost soil layer. For bare soil and pavements, no skin layer is 
    1670 !--    applied. In these cases, the temperature is assumed to be constant 
    1671 !--    between the surface and the first soil layer. The heat conductivity is 
    1672 !--    then derived from the soil/pavement properties. 
     1668!--    uppermost soil layer. For bare soil and pavements, no skin layer is
     1669!--    applied. In these cases, the temperature is assumed to be constant
     1670!--    between the surface and the first soil layer. The heat conductivity is
     1671!--    then derived from the soil/pavement properties.
    16731672!--    For water surfaces, the conductivity is already set to 1E10.
    16741673!--    Moreover, the heat capacity is set. For bare soil the heat capacity is
     
    16841683          lambda_h_sat = lambda_h_sm**(1.0_wp - surf%m_sat(nzb_soil,m)) *      &
    16851684                         lambda_h_water ** surf_m_soil%var_2d(nzb_soil,m)
    1686                          
     1685
    16871686          ke = 1.0_wp + LOG10( MAX( 0.1_wp, surf_m_soil%var_2d(nzb_soil,m) /   &
    1688                                                      surf%m_sat(nzb_soil,m) ) )                   
    1689                          
     1687                                                     surf%m_sat(nzb_soil,m) ) )
     1688
    16901689          lambda_soil = (ke * (lambda_h_sat - lambda_h_dry) + lambda_h_dry )   &
    16911690                           * ddz_soil(nzb_soil) * 2.0_wp
     
    16951694!--       a heat capacity is that of the soil layer, otherwise it is a
    16961695!--       combination of the conductivities from the skin and the soil layer
    1697           IF ( surf%lambda_surface_s(m) == 0.0_wp )  THEN 
     1696          IF ( surf%lambda_surface_s(m) == 0.0_wp )  THEN
    16981697            surf%c_surface(m) = (rho_c_soil * (1.0_wp - surf%m_sat(nzb_soil,m))&
    16991698                              + rho_c_water * surf_m_soil%var_2d(nzb_soil,m) ) &
    1700                               * dz_soil(nzb_soil) * 0.5_wp   
     1699                              * dz_soil(nzb_soil) * 0.5_wp
    17011700            lambda_surface = lambda_soil
    17021701
     
    17171716!--    Set heat capacity of the skin/surface. It is ususally zero when a skin
    17181717!--    layer is used, and non-zero otherwise.
    1719        c_surface_tmp = surf%c_surface(m) 
     1718       c_surface_tmp = surf%c_surface(m)
    17201719
    17211720!
     
    17291728!        ELSEIF ( cloud_droplets ) THEN
    17301729!           pt1 = pt(k,j,i) + lv_d_cp * d_exner(k) * ql(k,j,i)
    1731 !           qv1 = q(k,j,i) 
     1730!           qv1 = q(k,j,i)
    17321731!        ELSE
    17331732!           pt1 = pt(k,j,i)
     
    17431742!--     heat transfer coefficient for forced convection along vertical walls
    17441743!--     follows formulation in TUF3d model (Krayenhoff & Voogt, 2006)
    1745 !--           
     1744!--
    17461745!--       H = httc (Tsfc - Tair)
    17471746!--       httc = rw * (11.8 + 4.2 * Ueff) - 4.0
    1748 !--           
     1747!--
    17491748!--             rw: wall patch roughness relative to 1.0 for concrete
    17501749!--             Ueff: effective wind speed
    17511750!--             - 4.0 is a reduction of Rowley et al (1930) formulation based on
    17521751!--             Cole and Sturrock (1977)
    1753 !--           
     1752!--
    17541753!--             Ucan: Canyon wind speed
    17551754!--             wstar: convective velocity
     
    17571756!--             zH: height of the convective layer
    17581757!--             wstar = (g/Tcan*Qs*zH)**(1./3.)
    1759                
    1760 !--    Effective velocity components must always 
    1761 !--    be defined at scalar grid point. The wall normal component is 
     1758
     1759!--    Effective velocity components must always
     1760!--    be defined at scalar grid point. The wall normal component is
    17621761!--    obtained by simple linear interpolation. ( An alternative would
    17631762!--    be an logarithmic interpolation. )
     
    17651764!--    1000 is used in the nominator for scaling)
    17661765!--    To do: detailed investigation which approach gives more reliable results!
    1767 !--    Please note, in case of very small friction velocity, e.g. in little 
    1768 !--    holes, the resistance can become negative. For this reason, limit r_a 
    1769 !--    to positive values. 
     1766!--    Please note, in case of very small friction velocity, e.g. in little
     1767!--    holes, the resistance can become negative. For this reason, limit r_a
     1768!--    to positive values.
    17701769       IF ( horizontal  .OR.  .NOT. aero_resist_kray )  THEN
    17711770          surf%r_a(m) = ABS( ( surf%pt1(m) - surf%pt_surface(m) ) /            &
     
    17781777                                   ( ( w(k,j,i) + w(k-1,j,i) ) * 0.5_wp )**2,  &
    17791778                              0.01_wp ) )                                      &
    1780                            )  - 4.0_wp  ) 
     1779                           )  - 4.0_wp  )
    17811780       ENDIF
    17821781!
    1783 !--    Make sure that the resistance does not drop to zero for neutral 
     1782!--    Make sure that the resistance does not drop to zero for neutral
    17841783!--    stratification. Also, set a maximum resistance to avoid the breakdown of
    17851784!--    MOST for locations with zero wind speed
    17861785       IF ( surf%r_a(m) <   1.0_wp )  surf%r_a(m) =   1.0_wp
    1787        IF ( surf%r_a(m) > 300.0_wp )  surf%r_a(m) = 300.0_wp       
     1786       IF ( surf%r_a(m) > 300.0_wp )  surf%r_a(m) = 300.0_wp
    17881787!
    17891788!--    Second step: calculate canopy resistance r_canopy
    17901789!--    f1-f3 here are defined as 1/f1-f3 as in ECMWF documentation
    1791  
    1792 !--    f1: correction for incoming shortwave radiation (stomata close at 
     1790
     1791!--    f1: correction for incoming shortwave radiation (stomata close at
    17931792!--    night)
    17941793       f1 = MIN( 1.0_wp, ( 0.004_wp * surf%rad_sw_in(m) + 0.05_wp ) /          &
     
    17971796
    17981797!
    1799 !--    f2: correction for soil moisture availability to plants (the 
     1798!--    f2: correction for soil moisture availability to plants (the
    18001799!--    integrated soil moisture must thus be considered here)
    18011800!--    f2 = 0 for very dry soils
     
    18041803           m_total = m_total + surf%root_fr(ks,m)                              &
    18051804                     * MAX( surf_m_soil%var_2d(ks,m), surf%m_wilt(ks,m) )
    1806        ENDDO 
     1805       ENDDO
    18071806
    18081807!
     
    18541853
    18551854       surf%r_soil(m) = surf%r_soil_min(m) / f2
    1856        
     1855
    18571856!
    18581857!--    Calculate the maximum possible liquid water amount on plants and
    18591858!--    bare surface. For vegetated surfaces, a maximum depth of 0.2 mm is
    1860 !--    assumed, while paved surfaces might hold up 1 mm of water. The 
    1861 !--    liquid water fraction for paved surfaces is calculated after 
    1862 !--    Masson (2000) (TEB model) and originates from Noilhan & Planton (1989), 
     1859!--    assumed, while paved surfaces might hold up 1 mm of water. The
     1860!--    liquid water fraction for paved surfaces is calculated after
     1861!--    Masson (2000) (TEB model) and originates from Noilhan & Planton (1989),
    18631862!--    while the ECMWF formulation is used for vegetated surfaces and bare soils.
    18641863       IF ( surf%pavement_surface(m) )  THEN
     
    18821881
    18831882!
    1884 !--    Calculate coefficients for the total evapotranspiration 
     1883!--    Calculate coefficients for the total evapotranspiration
    18851884!--    In case of water surface, set vegetation and soil fluxes to zero.
    18861885!--    For pavements, only evaporation of liquid water is possible.
     
    19141913!
    19151914!--    Calculate net radiation radiation without longwave outgoing flux because
    1916 !--    it has a dependency on surface temperature and thus enters the prognostic 
     1915!--    it has a dependency on surface temperature and thus enters the prognostic
    19171916!--    equations directly
    19181917       surf%rad_net_l(m) = surf%rad_sw_in(m) - surf%rad_sw_out(m)              &
     
    19531952       surf_t_surface_p%var_1d(m) = ( coef_1 * dt_3d * tsc(2) + c_surface_tmp *&
    19541953                          surf_t_surface%var_1d(m) ) / ( c_surface_tmp + coef_2&
    1955                                              * dt_3d * tsc(2) ) 
     1954                                             * dt_3d * tsc(2) )
    19561955
    19571956!
     
    19851984!--    especially when setting skip_time_do_radiation /= 0. The threshold
    19861985!--    value of 0.2 used here is just a first guess. This method should be
    1987 !--    revised in the future as tests have shown that the threshold is 
     1986!--    revised in the future as tests have shown that the threshold is
    19881987!--    often reached, when no oscillations would occur (causes immense
    19891988!--    computing time for the radiation code).
     
    20502049       ENDIF
    20512050!
    2052 !--    Calculate change in liquid water reservoir due to dew fall or 
     2051!--    Calculate change in liquid water reservoir due to dew fall or
    20532052!--    evaporation of liquid water
    20542053       IF ( humidity )  THEN
     
    20622061!--          Add precipitation to liquid water reservoir, if possible.
    20632062!--          Otherwise, add the water to soil. In case of
    2064 !--          pavements, the exceeding water amount is explicitly removed 
     2063!--          pavements, the exceeding water amount is explicitly removed
    20652064!--          (as fictive runoff by drainage systems)
    20662065             IF ( surf%pavement_surface(m) )  THEN
     
    20702069                                 * hyrho(k+k_off)                              &
    20712070                                 * 0.001_wp * rho_l * l_v
    2072                 ENDIF         
     2071                ENDIF
    20732072             ELSE
    20742073                IF ( surf_m_liq%var_1d(m) < m_liq_max )  THEN
     
    20802079                                 surf%c_veg(m) ) * prr(k+k_off,j+j_off,i+i_off)&
    20812080                                 * hyrho(k+k_off)                              &
    2082                                  * 0.001_wp * rho_l * l_v                                 
     2081                                 * 0.001_wp * rho_l * l_v
    20832082                ELSE
    20842083
     
    21012100!--          Check if reservoir is full (avoid values > m_liq_max)
    21022101!--          In that case, qsws_liq goes to qsws_soil for pervious surfaces. In
    2103 !--          this case qsws_veg is zero anyway (because c_liq = 1),       
     2102!--          this case qsws_veg is zero anyway (because c_liq = 1),
    21042103!--          so that tend is zero and no further check is needed
    21052104             IF ( surf_m_liq%var_1d(m) == m_liq_max )  THEN
     
    21112110
    21122111!
    2113 !--          In case qsws_veg becomes negative (unphysical behavior), 
     2112!--          In case qsws_veg becomes negative (unphysical behavior),
    21142113!--          let the water enter the liquid water reservoir as dew on the
    21152114!--          plant
     
    21182117                surf%qsws_veg(m) = 0.0_wp
    21192118             ENDIF
    2120           ENDIF                   
    2121  
     2119          ENDIF
     2120
    21222121          surf%qsws(m) = surf%qsws(m) / l_v
    2123  
     2122
    21242123          tend = - surf%qsws_liq(m) * drho_l_lv
    21252124          surf_m_liq_p%var_1d(m) = surf_m_liq%var_1d(m) + dt_3d *              &
     
    21762175!-- Calculate new roughness lengths (for water surfaces only)
    21772176    IF ( horizontal  .AND.  .NOT. constant_roughness )  CALL calc_z0_water_surface
    2178    
     2177
    21792178    IF ( debug_output_timestep )  THEN
    21802179       WRITE( debug_string, * ) 'lsm_energy_balance', horizontal, l
     
    22022201       DO  m = 1, surf%ns
    22032202
    2204           i   = surf%i(m)           
     2203          i   = surf%i(m)
    22052204          j   = surf%j(m)
    22062205          k   = surf%k(m)
    22072206!
    22082207!--       Calculate water vapour pressure at saturation and convert to hPa
    2209           e_s = 0.01_wp * magnus( MIN(surf_t_surface_p%var_1d(m), 333.15_wp) )                   
     2208          e_s = 0.01_wp * magnus( MIN(surf_t_surface_p%var_1d(m), 333.15_wp) )
    22102209
    22112210!
     
    22262225                                          q(k,j,i)
    22272226          ENDIF
    2228          
     2227
    22292228          surf%q_surface(m) = q(k+k_off,j+j_off,i+i_off)
    22302229!
     
    22332232                                  ( 1.0_wp + 0.61_wp * surf%q_surface(m) )
    22342233
    2235        
    2236                      
     2234
     2235
    22372236       ENDDO
    22382237       !$OMP END PARALLEL
    2239  
     2238
    22402239    END SUBROUTINE calc_q_surface
    2241        
     2240
    22422241 END SUBROUTINE lsm_energy_balance
    2243    
    2244    
     2242
     2243
    22452244
    22462245!------------------------------------------------------------------------------!
     
    22602259       CHARACTER (LEN=86) ::  soil_depth_chr      !< String for soil depth
    22612260       CHARACTER (LEN=20) ::  coor_chr            !< Temporary string
    2262    
     2261
    22632262       INTEGER(iwp) ::  i                         !< Loop index over soil layers
    2264  
     2263
    22652264       INTEGER(iwp), INTENT(IN) ::  io            !< Unit of the output file
    2266  
     2265
    22672266       t_soil_chr = ''
    22682267       m_soil_chr    = ''
    2269        soil_depth_chr  = '' 
    2270        roots_chr        = '' 
     2268       soil_depth_chr  = ''
     2269       roots_chr        = ''
    22712270       vertical_index_chr   = ''
    22722271
     
    231323122   FORMAT ('    --> Soil bottom is closed (water content is conserved',       &
    23142313            ', default)')
    2315 3   FORMAT ('    --> Soil bottom is open (water content is not conserved)')         
     23143   FORMAT ('    --> Soil bottom is open (water content is not conserved)')
    231623154   FORMAT ('    --> Land surface type  : ',A,/                                &
    23172316            '    --> Soil porosity type : ',A)
     
    23462345        ONLY:  pmc_is_rootmodel
    23472346#endif
    2348            
     2347
    23492348       USE pmc_interface,                                                      &
    23502349           ONLY:  nested_run
    2351    
     2350
    23522351       IMPLICIT NONE
    23532352
     
    23622361       INTEGER(iwp) ::  m                       !< running index
    23632362       INTEGER(iwp) ::  st                      !< soil-type index
    2364        INTEGER(iwp) ::  n_soil_layers_total     !< temperature variable, stores the total number of soil layers + 4 
     2363       INTEGER(iwp) ::  n_soil_layers_total     !< temperature variable, stores the total number of soil layers + 4
    23652364#if defined( __parallel )
    23662365       INTEGER(iwp) ::  nzs_root                !< number of soil layers in root domain (used in case soil data needs to be
     
    23742373
    23752374#if defined( __parallel )
    2376        REAL(wp), DIMENSION(:), ALLOCATABLE ::  m_soil_root    !< domain-averaged soil moisture profile in root domain 
     2375       REAL(wp), DIMENSION(:), ALLOCATABLE ::  m_soil_root    !< domain-averaged soil moisture profile in root domain
    23772376       REAL(wp), DIMENSION(:), ALLOCATABLE ::  t_soil_root    !< domain-averaged soil temperature profile in root domain
    23782377#endif
     
    24672466       ALLOCATE ( surf_lsm_h%rho_c_total_def(nzb_soil:nzt_soil,1:surf_lsm_h%ns) )
    24682467       ALLOCATE ( surf_lsm_h%root_fr(nzb_soil:nzt_soil,1:surf_lsm_h%ns)     )
    2469    
     2468
    24702469       surf_lsm_h%lambda_h     = 0.0_wp
    24712470!
     
    24732472       IF ( humidity )  THEN
    24742473          ALLOCATE ( surf_lsm_h%lambda_w(nzb_soil:nzt_soil,1:surf_lsm_h%ns) )
    2475           ALLOCATE ( surf_lsm_h%gamma_w(nzb_soil:nzt_soil,1:surf_lsm_h%ns)  ) 
    2476 
    2477           surf_lsm_h%lambda_w = 0.0_wp 
     2474          ALLOCATE ( surf_lsm_h%gamma_w(nzb_soil:nzt_soil,1:surf_lsm_h%ns)  )
     2475
     2476          surf_lsm_h%lambda_w = 0.0_wp
    24782477       ENDIF
    24792478!
     
    24902489          ALLOCATE ( surf_lsm_v(l)%m_wilt(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns)      )
    24912490          ALLOCATE ( surf_lsm_v(l)%n_vg(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns)        )
    2492           ALLOCATE ( surf_lsm_v(l)%rho_c_total(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns) ) 
    2493           ALLOCATE ( surf_lsm_v(l)%rho_c_total_def(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns) ) 
     2491          ALLOCATE ( surf_lsm_v(l)%rho_c_total(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns) )
     2492          ALLOCATE ( surf_lsm_v(l)%rho_c_total_def(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns) )
    24942493          ALLOCATE ( surf_lsm_v(l)%root_fr(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns)     )
    24952494
    2496           surf_lsm_v(l)%lambda_h     = 0.0_wp 
    2497          
     2495          surf_lsm_v(l)%lambda_h     = 0.0_wp
     2496
    24982497!
    24992498!--       If required, allocate humidity-related variables for the soil model
    25002499          IF ( humidity )  THEN
    25012500             ALLOCATE ( surf_lsm_v(l)%lambda_w(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns) )
    2502              ALLOCATE ( surf_lsm_v(l)%gamma_w(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns)  ) 
    2503 
    2504              surf_lsm_v(l)%lambda_w = 0.0_wp 
    2505           ENDIF     
     2501             ALLOCATE ( surf_lsm_v(l)%gamma_w(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns)  )
     2502
     2503             surf_lsm_v(l)%lambda_w = 0.0_wp
     2504          ENDIF
    25062505       ENDDO
    25072506!
    2508 !--    Allocate albedo type and emissivity for vegetation, water and pavement 
     2507!--    Allocate albedo type and emissivity for vegetation, water and pavement
    25092508!--    fraction.
    2510 !--    Set default values at each surface element. 
     2509!--    Set default values at each surface element.
    25112510       ALLOCATE ( surf_lsm_h%albedo_type(1:surf_lsm_h%ns,0:2) )
    25122511       ALLOCATE ( surf_lsm_h%emissivity(1:surf_lsm_h%ns,0:2) )
    25132512!
    25142513!--    Initialize albedo type according to its default type, in order to set values
    2515 !--    independent on default albedo_type in radiation model. 
     2514!--    independent on default albedo_type in radiation model.
    25162515       surf_lsm_h%albedo_type(:,ind_veg_wall)  =                               &
    25172516                             INT( vegetation_pars(ind_v_at,vegetation_type) )
     
    25252524          ALLOCATE ( surf_lsm_v(l)%emissivity(1:surf_lsm_v(l)%ns,0:2)  )
    25262525!
    2527 !--       Initialize albedo type according to its default type, in order to 
    2528 !--       set values independent on default albedo_type in radiation model. 
     2526!--       Initialize albedo type according to its default type, in order to
     2527!--       set values independent on default albedo_type in radiation model.
    25292528          surf_lsm_v(l)%albedo_type(:,ind_veg_wall)  =                         &
    25302529                             INT( vegetation_pars(ind_v_at,vegetation_type) )
     
    25362535       ENDDO
    25372536!
    2538 !--    Allocate arrays for relative surface fraction. 
     2537!--    Allocate arrays for relative surface fraction.
    25392538!--    0 - vegetation fraction, 2 - water fraction, 1 - pavement fraction
    25402539       ALLOCATE( surf_lsm_h%frac(1:surf_lsm_h%ns,0:2) )
     
    25462545!
    25472546!--    For vertical walls only - allocate special flag indicating if any building is on
    2548 !--    top of any natural surfaces. Used for initialization only. 
     2547!--    top of any natural surfaces. Used for initialization only.
    25492548       DO  l = 0, 3
    25502549          ALLOCATE( surf_lsm_v(l)%building_covered(1:surf_lsm_v(l)%ns) )
     
    25562555       ALLOCATE( surf_lsm_h%vegetation_type(1:surf_lsm_h%ns) )
    25572556       ALLOCATE( surf_lsm_h%water_type(1:surf_lsm_h%ns)      )
    2558        
     2557
    25592558       surf_lsm_h%pavement_type   = 0
    25602559       surf_lsm_h%vegetation_type = 0
    25612560       surf_lsm_h%water_type      = 0
    2562        
     2561
    25632562       ALLOCATE( surf_lsm_h%pavement_type_name(1:surf_lsm_h%ns)   )
    25642563       ALLOCATE( surf_lsm_h%vegetation_type_name(1:surf_lsm_h%ns) )
    25652564       ALLOCATE( surf_lsm_h%water_type_name(1:surf_lsm_h%ns)      )
    2566        
     2565
    25672566       surf_lsm_h%pavement_type_name   = 'none'
    25682567       surf_lsm_h%vegetation_type_name = 'none'
    25692568       surf_lsm_h%water_type_name      = 'none'
    2570        
     2569
    25712570       DO  l = 0, 3
    25722571          ALLOCATE( surf_lsm_v(l)%pavement_type(1:surf_lsm_v(l)%ns)   )
    25732572          ALLOCATE( surf_lsm_v(l)%vegetation_type(1:surf_lsm_v(l)%ns) )
    25742573          ALLOCATE( surf_lsm_v(l)%water_type(1:surf_lsm_v(l)%ns)      )
    2575          
     2574
    25762575          surf_lsm_v(l)%pavement_type   = 0
    25772576          surf_lsm_v(l)%vegetation_type = 0
    25782577          surf_lsm_v(l)%water_type      = 0
    2579        
     2578
    25802579          ALLOCATE( surf_lsm_v(l)%pavement_type_name(1:surf_lsm_v(l)%ns)   )
    25812580          ALLOCATE( surf_lsm_v(l)%vegetation_type_name(1:surf_lsm_v(l)%ns) )
    25822581          ALLOCATE( surf_lsm_v(l)%water_type_name(1:surf_lsm_v(l)%ns)      )
    2583        
     2582
    25842583          surf_lsm_v(l)%pavement_type_name   = 'none'
    25852584          surf_lsm_v(l)%vegetation_type_name = 'none'
    2586           surf_lsm_v(l)%water_type_name      = 'none'       
     2585          surf_lsm_v(l)%water_type_name      = 'none'
    25872586       ENDDO
    2588        
    2589 !
    2590 !--    Set flag parameter for the prescribed surface type depending on user 
     2587
     2588!
     2589!--    Set flag parameter for the prescribed surface type depending on user
    25912590!--    input. Set surface fraction to 1 for the respective type.
    25922591       SELECT CASE ( TRIM( surface_type ) )
    2593          
     2592
    25942593          CASE ( 'vegetation' )
    2595          
     2594
    25962595             surf_lsm_h%vegetation_surface = .TRUE.
    25972596             surf_lsm_h%frac(:,ind_veg_wall) = 1.0_wp
     
    26002599                surf_lsm_v(l)%frac(:,ind_veg_wall) = 1.0_wp
    26012600             ENDDO
    2602    
     2601
    26032602          CASE ( 'water' )
    2604              
     2603
    26052604             surf_lsm_h%water_surface = .TRUE.
    26062605             surf_lsm_h%frac(:,ind_wat_win) = 1.0_wp
    26072606!
    26082607!--          Note, vertical water surface does not really make sense.
    2609              DO  l = 0, 3 
     2608             DO  l = 0, 3
    26102609                surf_lsm_v(l)%water_surface   = .TRUE.
    26112610                surf_lsm_v(l)%frac(:,ind_wat_win) = 1.0_wp
     
    26132612
    26142613          CASE ( 'pavement' )
    2615              
     2614
    26162615             surf_lsm_h%pavement_surface = .TRUE.
    26172616                surf_lsm_h%frac(:,ind_pav_green) = 1.0_wp
     
    26442643                                  2, 2, myid, 6, 0 )
    26452644                ENDIF
    2646                
     2645
    26472646             ENDDO
    26482647!
    26492648!--          For vertical surfaces some special checks and treatment are
    2650 !--          required for correct initialization. 
     2649!--          required for correct initialization.
    26512650             DO  l = 0, 3
    26522651                DO  m = 1, surf_lsm_v(l)%ns
    26532652!
    2654 !--                Only for vertical surfaces. Check if at the grid point where 
    2655 !--                the wall is defined (i+ioff, j+joff) is any building. 
     2653!--                Only for vertical surfaces. Check if at the grid point where
     2654!--                the wall is defined (i+ioff, j+joff) is any building.
    26562655!--                This case, no natural surfaces properties will be defined at
    26572656!--                at this grid point, leading to problems in the initialization.
    26582657!--                To overcome this, define a special flag which
    2659 !--                indicates that a building is defined at the wall grid point 
    2660 !--                and take the surface properties from the adjoining grid 
     2658!--                indicates that a building is defined at the wall grid point
     2659!--                and take the surface properties from the adjoining grid
    26612660!--                point, i.e. without offset values.
    26622661!--                Further, there can occur a special case where elevation
    26632662!--                changes are larger than building heights. This case, (j,i)
    2664 !--                and (j+joff,i+ioff) grid points may be both covered by 
    2665 !--                buildings, but vertical, but vertically natural walls may 
    2666 !--                be located between the buildings. This case, it is not 
    2667 !--                guaranteed that information about natural surface types is 
    2668 !--                given, neither at (j,i) nor at (j+joff,i+ioff), again leading 
    2669 !--                to non-initialized surface properties. 
     2663!--                and (j+joff,i+ioff) grid points may be both covered by
     2664!--                buildings, but vertical, but vertically natural walls may
     2665!--                be located between the buildings. This case, it is not
     2666!--                guaranteed that information about natural surface types is
     2667!--                given, neither at (j,i) nor at (j+joff,i+ioff), again leading
     2668!--                to non-initialized surface properties.
    26702669                   surf_lsm_v(l)%building_covered(m) = .FALSE.
    26712670!
    2672 !--                Wall grid point is building-covered. This case, set 
    2673 !--                flag indicating that surface properties are initialized 
    2674 !--                from neighboring reference grid point, which is not 
    2675 !--                building_covered. 
     2671!--                Wall grid point is building-covered. This case, set
     2672!--                flag indicating that surface properties are initialized
     2673!--                from neighboring reference grid point, which is not
     2674!--                building_covered.
    26762675                   IF ( building_type_f%from_file )  THEN
    26772676                      i = surf_lsm_v(l)%i(m)
     
    26852684!--                   point are both building-covered. This case, surface
    26862685!--                   properties are not necessarily defined (not covered by
    2687 !--                   checks for static input file) at this surface. Hence, 
    2688 !--                   initialize surface properties by simply setting 
    2689 !--                   vegetation_type_f to bare-soil bulk parametrization. 
    2690 !--                   soil_type_f as well as surface_fractions_f will be set 
    2691 !--                   also.                     
     2686!--                   checks for static input file) at this surface. Hence,
     2687!--                   initialize surface properties by simply setting
     2688!--                   vegetation_type_f to bare-soil bulk parametrization.
     2689!--                   soil_type_f as well as surface_fractions_f will be set
     2690!--                   also.
    26922691                      IF ( building_type_f%var(j+surf_lsm_v(l)%joff,           &
    26932692                                               i+surf_lsm_v(l)%ioff) /=        &
     
    26962695                      THEN
    26972696                         vegetation_type_f%var(j,i)                 = 1 ! bare soil
    2698                          soil_type_f%var_2d(j,i)                    = 1 
    2699 !                         
    2700 !--                      If surface_fraction is provided in static input, 
     2697                         soil_type_f%var_2d(j,i)                    = 1
     2698!
     2699!--                      If surface_fraction is provided in static input,
    27012700!--                      set fraction for vegetation to one at building-covered
    27022701!--                      surfaces.
     
    27072706                         ENDIF
    27082707                      ENDIF
    2709                      
     2708
    27102709                   ENDIF
    27112710!
     
    27382737       END SELECT
    27392738!
    2740 !--    In case of netcdf input file, further initialize surface fractions. 
     2739!--    In case of netcdf input file, further initialize surface fractions.
    27412740!--    At the moment only 1 surface is given at a location, so that the fraction
    2742 !--    is either 0 or 1. This will be revised later. If surface fraction 
     2741!--    is either 0 or 1. This will be revised later. If surface fraction
    27432742!--    is not given in static input file, relative fractions will be derived
    27442743!--    from given surface type. In this case, only 1 type is given at a certain
    2745 !--    location (already checked). 
     2744!--    location (already checked).
    27462745       IF ( input_pids_static  .AND.  surface_fraction_f%from_file )  THEN
    27472746          DO  m = 1, surf_lsm_h%ns
     
    27732772                                 j, i, ') are all zero.'
    27742773                CALL message( 'land_surface_model_mod', 'PA0688',              &
    2775                                2, 2, myid, 6, 0 ) 
     2774                               2, 2, myid, 6, 0 )
    27762775             ENDIF
    27772776!
    27782777!--          In case the sum of all surfaces is not 1, which may happen
    27792778!--          due to rounding errors or type conversions, normalize the
    2780 !--          fractions to one. Note, at the moment no tile approach is 
     2779!--          fractions to one. Note, at the moment no tile approach is
    27812780!--          implemented, so that relative fractions are either 1 or zero.
    27822781             IF ( SUM ( surf_lsm_h%frac(m,:) ) > 1.0_wp  .OR.                  &
     
    27912790             DO  m = 1, surf_lsm_v(l)%ns
    27922791                i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,         &
    2793                                                 surf_lsm_v(l)%building_covered(m) ) 
     2792                                                surf_lsm_v(l)%building_covered(m) )
    27942793                j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,         &
    2795                                                 surf_lsm_v(l)%building_covered(m) ) 
    2796 !
    2797 !--             0 - vegetation fraction, 1 - pavement fraction, 2 - water fraction       
     2794                                                surf_lsm_v(l)%building_covered(m) )
     2795!
     2796!--             0 - vegetation fraction, 1 - pavement fraction, 2 - water fraction
    27982797                IF ( surface_fraction_f%frac(ind_veg_wall,j,i) /=              &
    27992798                     surface_fraction_f%fill )  THEN
     
    28192818                                 j, i, ') are all zero.'
    28202819                   CALL message( 'land_surface_model_mod', 'PA0688',           &
    2821                                   2, 2, myid, 6, 0 ) 
     2820                                  2, 2, myid, 6, 0 )
    28222821                ENDIF
    28232822!
    28242823!--             In case the sum of all surfaces is not 1, which may happen
    28252824!--             due to rounding errors or type conversions, normalize the
    2826 !--             fractions to one. Note, at the moment no tile approach is 
     2825!--             fractions to one. Note, at the moment no tile approach is
    28272826!--             implemented, so that relative fractions are either 1 or zero.
    28282827                IF ( SUM ( surf_lsm_v(l)%frac(m,:) ) > 1.0_wp  .OR.            &
     
    28402839             j = surf_lsm_h%j(m)
    28412840
    2842              IF ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill )       &       
     2841             IF ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill )       &
    28432842                surf_lsm_h%frac(m,ind_veg_wall)  = 1.0_wp
    2844              IF ( pavement_type_f%var(j,i)   /= pavement_type_f%fill   )       &       
    2845                 surf_lsm_h%frac(m,ind_pav_green) = 1.0_wp 
    2846              IF ( water_type_f%var(j,i)      /= water_type_f%fill      )       &       
    2847                 surf_lsm_h%frac(m,ind_wat_win)   = 1.0_wp       
     2843             IF ( pavement_type_f%var(j,i)   /= pavement_type_f%fill   )       &
     2844                surf_lsm_h%frac(m,ind_pav_green) = 1.0_wp
     2845             IF ( water_type_f%var(j,i)      /= water_type_f%fill      )       &
     2846                surf_lsm_h%frac(m,ind_wat_win)   = 1.0_wp
    28482847          ENDDO
    28492848          DO  l = 0, 3
    28502849             DO  m = 1, surf_lsm_v(l)%ns
    28512850                i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,         &
    2852                                                 surf_lsm_v(l)%building_covered(m) ) 
     2851                                                surf_lsm_v(l)%building_covered(m) )
    28532852                j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,         &
    2854                                                 surf_lsm_v(l)%building_covered(m) ) 
    2855      
    2856                 IF ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill )    &       
     2853                                                surf_lsm_v(l)%building_covered(m) )
     2854
     2855                IF ( vegetation_type_f%var(j,i) /= vegetation_type_f%fill )    &
    28572856                   surf_lsm_v(l)%frac(m,ind_veg_wall)  = 1.0_wp
    2858                 IF ( pavement_type_f%var(j,i)   /= pavement_type_f%fill   )    &       
    2859                    surf_lsm_v(l)%frac(m,ind_pav_green) = 1.0_wp 
    2860                 IF ( water_type_f%var(j,i)      /= water_type_f%fill      )    &       
    2861                    surf_lsm_v(l)%frac(m,ind_wat_win)   = 1.0_wp     
     2857                IF ( pavement_type_f%var(j,i)   /= pavement_type_f%fill   )    &
     2858                   surf_lsm_v(l)%frac(m,ind_pav_green) = 1.0_wp
     2859                IF ( water_type_f%var(j,i)      /= water_type_f%fill      )    &
     2860                   surf_lsm_v(l)%frac(m,ind_wat_win)   = 1.0_wp
    28622861             ENDDO
    28632862          ENDDO
     
    28652864!
    28662865!--    Level 1, initialization of soil parameters.
    2867 !--    It is possible to overwrite each parameter by setting the respecticy 
    2868 !--    NAMELIST variable to a value /= 9999999.9. 
    2869        IF ( soil_type /= 0 )  THEN 
    2870  
     2866!--    It is possible to overwrite each parameter by setting the respecticy
     2867!--    NAMELIST variable to a value /= 9999999.9.
     2868       IF ( soil_type /= 0 )  THEN
     2869
    28712870          IF ( alpha_vangenuchten == 9999999.9_wp )  THEN
    28722871             alpha_vangenuchten = soil_pars(0,soil_type)
     
    28782877
    28792878          IF ( n_vangenuchten == 9999999.9_wp )  THEN
    2880              n_vangenuchten = soil_pars(2,soil_type)           
     2879             n_vangenuchten = soil_pars(2,soil_type)
    28812880          ENDIF
    28822881
    28832882          IF ( hydraulic_conductivity == 9999999.9_wp )  THEN
    2884              hydraulic_conductivity = soil_pars(3,soil_type)           
     2883             hydraulic_conductivity = soil_pars(3,soil_type)
    28852884          ENDIF
    28862885
    28872886          IF ( saturation_moisture == 9999999.9_wp )  THEN
    2888              saturation_moisture = soil_pars(4,soil_type)           
     2887             saturation_moisture = soil_pars(4,soil_type)
    28892888          ENDIF
    28902889
    28912890          IF ( field_capacity == 9999999.9_wp )  THEN
    2892              field_capacity = soil_pars(5,soil_type)           
     2891             field_capacity = soil_pars(5,soil_type)
    28932892          ENDIF
    28942893
    28952894          IF ( wilting_point == 9999999.9_wp )  THEN
    2896              wilting_point = soil_pars(6,soil_type)           
     2895             wilting_point = soil_pars(6,soil_type)
    28972896          ENDIF
    28982897
    28992898          IF ( residual_moisture == 9999999.9_wp )  THEN
    2900              residual_moisture = soil_pars(7,soil_type)       
     2899             residual_moisture = soil_pars(7,soil_type)
    29012900          ENDIF
    29022901
     
    29072906       surf_lsm_h%alpha_vg      = alpha_vangenuchten
    29082907       surf_lsm_h%l_vg          = l_vangenuchten
    2909        surf_lsm_h%n_vg          = n_vangenuchten 
     2908       surf_lsm_h%n_vg          = n_vangenuchten
    29102909       surf_lsm_h%gamma_w_sat   = hydraulic_conductivity
    29112910       surf_lsm_h%m_sat         = saturation_moisture
     
    29192918          surf_lsm_v(l)%alpha_vg      = alpha_vangenuchten
    29202919          surf_lsm_v(l)%l_vg          = l_vangenuchten
    2921           surf_lsm_v(l)%n_vg          = n_vangenuchten 
     2920          surf_lsm_v(l)%n_vg          = n_vangenuchten
    29222921          surf_lsm_v(l)%gamma_w_sat   = hydraulic_conductivity
    29232922          surf_lsm_v(l)%m_sat         = saturation_moisture
     
    29292928!
    29302929!--    Level 2, initialization of soil parameters via soil_type read from file.
    2931 !--    Soil parameters are initialized for each (y,x)-grid point 
     2930!--    Soil parameters are initialized for each (y,x)-grid point
    29322931!--    individually using default paramter settings according to the given
    29332932!--    soil type.
    29342933       IF ( soil_type_f%from_file )  THEN
    29352934!
    2936 !--       Level of detail = 1, i.e. a homogeneous soil distribution along the 
     2935!--       Level of detail = 1, i.e. a homogeneous soil distribution along the
    29372936!--       vertical dimension is assumed.
    29382937          IF ( soil_type_f%lod == 1 )  THEN
     
    29422941                i = surf_lsm_h%i(m)
    29432942                j = surf_lsm_h%j(m)
    2944              
     2943
    29452944                st = soil_type_f%var_2d(j,i)
    29462945                IF ( st /= soil_type_f%fill )  THEN
     
    29562955             ENDDO
    29572956!
    2958 !--          Vertical surfaces ( assumes the soil type given at respective (x,y) 
     2957!--          Vertical surfaces ( assumes the soil type given at respective (x,y)
    29592958             DO  l = 0, 3
    29602959                DO  m = 1, surf_lsm_v(l)%ns
    29612960                   i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,      &
    2962                                                    surf_lsm_v(l)%building_covered(m) ) 
     2961                                                   surf_lsm_v(l)%building_covered(m) )
    29632962                   j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,      &
    2964                                                    surf_lsm_v(l)%building_covered(m) ) 
     2963                                                   surf_lsm_v(l)%building_covered(m) )
    29652964
    29662965                   st = soil_type_f%var_2d(j,i)
     
    29792978!
    29802979!--       Level of detail = 2, i.e. soil type and thus the soil parameters
    2981 !--       can be heterogeneous along the vertical dimension. 
     2980!--       can be heterogeneous along the vertical dimension.
    29822981          ELSE
    29832982!
     
    29862985                i = surf_lsm_h%i(m)
    29872986                j = surf_lsm_h%j(m)
    2988              
     2987
    29892988                DO  k = nzb_soil, nzt_soil
    29902989                   st = soil_type_f%var_3d(k,j,i)
     
    30023001             ENDDO
    30033002!
    3004 !--          Vertical surfaces ( assumes the soil type given at respective (x,y) 
     3003!--          Vertical surfaces ( assumes the soil type given at respective (x,y)
    30053004             DO  l = 0, 3
    30063005                DO  m = 1, surf_lsm_v(l)%ns
    30073006                   i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,      &
    3008                                                    surf_lsm_v(l)%building_covered(m) ) 
     3007                                                   surf_lsm_v(l)%building_covered(m) )
    30093008                   j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,      &
    3010                                                    surf_lsm_v(l)%building_covered(m) ) 
     3009                                                   surf_lsm_v(l)%building_covered(m) )
    30113010
    30123011                   DO  k = nzb_soil, nzt_soil
     
    30283027       ENDIF
    30293028!
    3030 !--    Level 3, initialization of single soil parameters at single z,x,y 
     3029!--    Level 3, initialization of single soil parameters at single z,x,y
    30313030!--    position via soil_pars read from file.
    30323031       IF ( soil_pars_f%from_file )  THEN
    30333032!
    3034 !--       Level of detail = 1, i.e. a homogeneous vertical distribution of soil 
     3033!--       Level of detail = 1, i.e. a homogeneous vertical distribution of soil
    30353034!--       parameters is assumed.
    30363035!--       Horizontal surfaces
    30373036          IF ( soil_pars_f%lod == 1 )  THEN
    30383037!
    3039 !--          Horizontal surfaces 
     3038!--          Horizontal surfaces
    30403039             DO  m = 1, surf_lsm_h%ns
    30413040                i = surf_lsm_h%i(m)
     
    30613060             ENDDO
    30623061!
    3063 !--          Vertical surfaces 
     3062!--          Vertical surfaces
    30643063             DO  l = 0, 3
    30653064                DO  m = 1, surf_lsm_v(l)%ns
    30663065                   i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,      &
    3067                                                    surf_lsm_v(l)%building_covered(m) ) 
     3066                                                   surf_lsm_v(l)%building_covered(m) )
    30683067                   j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,      &
    3069                                                    surf_lsm_v(l)%building_covered(m) ) 
     3068                                                   surf_lsm_v(l)%building_covered(m) )
    30703069
    30713070                   IF ( soil_pars_f%pars_xy(0,j,i) /= soil_pars_f%fill )           &
     
    30893088             ENDDO
    30903089!
    3091 !--       Level of detail = 2, i.e. soil parameters can be set at each soil 
    3092 !--       layer individually. 
     3090!--       Level of detail = 2, i.e. soil parameters can be set at each soil
     3091!--       layer individually.
    30933092          ELSE
    30943093!
     
    31193118             ENDDO
    31203119!
    3121 !--          Vertical surfaces 
     3120!--          Vertical surfaces
    31223121             DO  l = 0, 3
    31233122                DO  m = 1, surf_lsm_v(l)%ns
    31243123                   i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,      &
    3125                                                    surf_lsm_v(l)%building_covered(m) ) 
     3124                                                   surf_lsm_v(l)%building_covered(m) )
    31263125                   j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,      &
    3127                                                    surf_lsm_v(l)%building_covered(m) ) 
     3126                                                   surf_lsm_v(l)%building_covered(m) )
    31283127
    31293128                   DO  k = nzb_soil, nzt_soil
     
    31533152
    31543153!
    3155 !--    Level 1, initialization of vegetation parameters. A horizontally 
    3156 !--    homogeneous distribution is assumed here. 
     3154!--    Level 1, initialization of vegetation parameters. A horizontally
     3155!--    homogeneous distribution is assumed here.
    31573156       IF ( vegetation_type /= 0 )  THEN
    31583157
     
    31623161
    31633162          IF ( leaf_area_index == 9999999.9_wp )  THEN
    3164              leaf_area_index = vegetation_pars(ind_v_rc_lai,vegetation_type)         
     3163             leaf_area_index = vegetation_pars(ind_v_rc_lai,vegetation_type)
    31653164          ENDIF
    31663165
    31673166          IF ( vegetation_coverage == 9999999.9_wp )  THEN
    3168              vegetation_coverage = vegetation_pars(ind_v_c_veg,vegetation_type)     
     3167             vegetation_coverage = vegetation_pars(ind_v_c_veg,vegetation_type)
    31693168          ENDIF
    31703169
    31713170          IF ( canopy_resistance_coefficient == 9999999.9_wp )  THEN
    3172               canopy_resistance_coefficient= vegetation_pars(ind_v_gd,vegetation_type)     
     3171              canopy_resistance_coefficient= vegetation_pars(ind_v_gd,vegetation_type)
    31733172          ENDIF
    31743173
    31753174          IF ( z0_vegetation == 9999999.9_wp )  THEN
    3176              z0_vegetation  = vegetation_pars(ind_v_z0,vegetation_type) 
     3175             z0_vegetation  = vegetation_pars(ind_v_z0,vegetation_type)
    31773176          ENDIF
    31783177
    31793178          IF ( z0h_vegetation == 9999999.9_wp )  THEN
    31803179             z0h_vegetation = vegetation_pars(ind_v_z0qh,vegetation_type)
    3181           ENDIF 
    3182          
     3180          ENDIF
     3181
    31833182          IF ( z0q_vegetation == 9999999.9_wp )  THEN
    31843183             z0q_vegetation = vegetation_pars(ind_v_z0qh,vegetation_type)
    31853184          ENDIF
    3186          
     3185
    31873186          IF ( lambda_surface_stable == 9999999.9_wp )  THEN
    3188              lambda_surface_stable = vegetation_pars(ind_v_lambda_s,vegetation_type) 
     3187             lambda_surface_stable = vegetation_pars(ind_v_lambda_s,vegetation_type)
    31893188          ENDIF
    31903189
    31913190          IF ( lambda_surface_unstable == 9999999.9_wp )  THEN
    3192              lambda_surface_unstable = vegetation_pars(ind_v_lambda_u,vegetation_type)           
     3191             lambda_surface_unstable = vegetation_pars(ind_v_lambda_u,vegetation_type)
    31933192          ENDIF
    31943193
    31953194          IF ( f_shortwave_incoming == 9999999.9_wp )  THEN
    3196              f_shortwave_incoming = vegetation_pars(ind_v_f_sw_in,vegetation_type)       
     3195             f_shortwave_incoming = vegetation_pars(ind_v_f_sw_in,vegetation_type)
    31973196          ENDIF
    31983197
    31993198          IF ( c_surface == 9999999.9_wp )  THEN
    3200              c_surface = vegetation_pars(ind_v_c_surf,vegetation_type)       
     3199             c_surface = vegetation_pars(ind_v_c_surf,vegetation_type)
    32013200          ENDIF
    32023201
    32033202          IF ( albedo_type == 9999999  .AND.  albedo == 9999999.9_wp )  THEN
    3204              albedo_type = INT(vegetation_pars(ind_v_at,vegetation_type))       
    3205           ENDIF
    3206    
     3203             albedo_type = INT(vegetation_pars(ind_v_at,vegetation_type))
     3204          ENDIF
     3205
    32073206          IF ( emissivity == 9999999.9_wp )  THEN
    3208              emissivity = vegetation_pars(ind_v_emis,vegetation_type)     
     3207             emissivity = vegetation_pars(ind_v_emis,vegetation_type)
    32093208          ENDIF
    32103209
     
    32273226             surf_lsm_h%albedo_type(m,ind_veg_wall) = albedo_type
    32283227             surf_lsm_h%emissivity(m,ind_veg_wall)  = emissivity
    3229              
     3228
    32303229             surf_lsm_h%vegetation_type(m)      = vegetation_type
    32313230             surf_lsm_h%vegetation_type_name(m) = vegetation_type_name(vegetation_type)
     
    32353234             surf_lsm_h%g_d(m)   = 0.0_wp
    32363235          ENDIF
    3237  
     3236
    32383237       ENDDO
    32393238!
     
    32563255                surf_lsm_v(l)%albedo_type(m,ind_veg_wall) = albedo_type
    32573256                surf_lsm_v(l)%emissivity(m,ind_veg_wall)  = emissivity
    3258                
     3257
    32593258                surf_lsm_v(l)%vegetation_type(m)      = vegetation_type
    32603259                surf_lsm_v(l)%vegetation_type_name(m) = vegetation_type_name(vegetation_type)
     
    32693268!
    32703269!--    Level 2, initialization of vegation parameters via vegetation_type read
    3271 !--    from file. Vegetation parameters are initialized for each (y,x)-grid point 
     3270!--    from file. Vegetation parameters are initialized for each (y,x)-grid point
    32723271!--    individually using default paramter settings according to the given
    32733272!--    vegetation type.
     
    32783277             i = surf_lsm_h%i(m)
    32793278             j = surf_lsm_h%j(m)
    3280              
     3279
    32813280             st = vegetation_type_f%var(j,i)
    32823281             IF ( st /= vegetation_type_f%fill  .AND.  st /= 0 )  THEN
     
    32943293                surf_lsm_h%albedo_type(m,ind_veg_wall) = INT( vegetation_pars(ind_v_at,st) )
    32953294                surf_lsm_h%emissivity(m,ind_veg_wall)  = vegetation_pars(ind_v_emis,st)
    3296                
     3295
    32973296                surf_lsm_h%vegetation_type(m)      = st
    32983297                surf_lsm_h%vegetation_type_name(m) = vegetation_type_name(st)
     
    33043303             DO  m = 1, surf_lsm_v(l)%ns
    33053304                i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,         &
    3306                                                 surf_lsm_v(l)%building_covered(m) ) 
     3305                                                surf_lsm_v(l)%building_covered(m) )
    33073306                j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,      &
    3308                                                 surf_lsm_v(l)%building_covered(m) ) 
    3309              
     3307                                                surf_lsm_v(l)%building_covered(m) )
     3308
    33103309                st = vegetation_type_f%var(j,i)
    33113310                IF ( st /= vegetation_type_f%fill  .AND.  st /= 0 )  THEN
     
    33233322                   surf_lsm_v(l)%albedo_type(m,ind_veg_wall) = INT( vegetation_pars(ind_v_at,st) )
    33243323                   surf_lsm_v(l)%emissivity(m,ind_veg_wall)  = vegetation_pars(ind_v_emis,st)
    3325                    
     3324
    33263325                   surf_lsm_v(l)%vegetation_type(m)      = st
    33273326                   surf_lsm_v(l)%vegetation_type_name(m) = vegetation_type_name(st)
     
    33313330       ENDIF
    33323331!
    3333 !--    Level 3, initialization of vegation parameters at single (x,y) 
     3332!--    Level 3, initialization of vegation parameters at single (x,y)
    33343333!--    position via vegetation_pars read from file.
    33353334       IF ( vegetation_pars_f%from_file )  THEN
    33363335!
    3337 !--       Horizontal surfaces 
     3336!--       Horizontal surfaces
    33383337          DO  m = 1, surf_lsm_h%ns
    33393338
     
    33413340             j = surf_lsm_h%j(m)
    33423341!
    3343 !--          If surface element is not a vegetation surface and any value in 
     3342!--          If surface element is not a vegetation surface and any value in
    33443343!--          vegetation_pars is given, neglect this information and give an
    3345 !--          informative message that this value will not be used.   
     3344!--          informative message that this value will not be used.
    33463345             IF ( .NOT. surf_lsm_h%vegetation_surface(m)  .AND.                &
    33473346                   ANY( vegetation_pars_f%pars_xy(:,j,i) /=                    &
     
    33513350                                 j, i, ') is not a vegetation surface, ',      &
    33523351                                 'so that information given in ',              &
    3353                                  'vegetation_pars at this point is neglected.' 
     3352                                 'vegetation_pars at this point is neglected.'
    33543353                CALL message( 'land_surface_model_mod', 'PA0436', 0, 0, myid, 6, 0 )
    33553354             ELSE
     
    34093408          ENDDO
    34103409!
    3411 !--       Vertical surfaces 
     3410!--       Vertical surfaces
    34123411          DO  l = 0, 3
    34133412             DO  m = 1, surf_lsm_v(l)%ns
    34143413                i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,         &
    3415                                                 surf_lsm_v(l)%building_covered(m) ) 
     3414                                                surf_lsm_v(l)%building_covered(m) )
    34163415                j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,         &
    3417                                                 surf_lsm_v(l)%building_covered(m) ) 
    3418 !
    3419 !--             If surface element is not a vegetation surface and any value in 
     3416                                                surf_lsm_v(l)%building_covered(m) )
     3417!
     3418!--             If surface element is not a vegetation surface and any value in
    34203419!--             vegetation_pars is given, neglect this information and give an
    3421 !--             informative message that this value will not be used.   
     3420!--             informative message that this value will not be used.
    34223421                IF ( .NOT. surf_lsm_v(l)%vegetation_surface(m)  .AND.          &
    34233422                      ANY( vegetation_pars_f%pars_xy(:,j,i) /=                 &
     
    34273426                                 j, i, ') is not a vegetation surface, ',      &
    34283427                                 'so that information given in ',              &
    3429                                  'vegetation_pars at this point is neglected.' 
     3428                                 'vegetation_pars at this point is neglected.'
    34303429                   CALL message( 'land_surface_model_mod', 'PA0436', 0, 0, myid, 6, 0 )
    34313430                ELSE
     
    34863485             ENDDO
    34873486          ENDDO
    3488        ENDIF 
    3489 
    3490 !
    3491 !--    Level 1, initialization of water parameters. A horizontally 
    3492 !--    homogeneous distribution is assumed here. 
     3487       ENDIF
     3488
     3489!
     3490!--    Level 1, initialization of water parameters. A horizontally
     3491!--    homogeneous distribution is assumed here.
    34933492       IF ( water_type /= 0 )  THEN
    34943493
    34953494          IF ( water_temperature == 9999999.9_wp )  THEN
    3496              water_temperature = water_pars(ind_w_temp,water_type)       
     3495             water_temperature = water_pars(ind_w_temp,water_type)
    34973496          ENDIF
    34983497
    34993498          IF ( z0_water == 9999999.9_wp )  THEN
    3500              z0_water = water_pars(ind_w_z0,water_type)       
    3501           ENDIF       
     3499             z0_water = water_pars(ind_w_z0,water_type)
     3500          ENDIF
    35023501
    35033502          IF ( z0h_water == 9999999.9_wp )  THEN
    3504              z0h_water = water_pars(ind_w_z0h,water_type)       
    3505           ENDIF 
    3506          
     3503             z0h_water = water_pars(ind_w_z0h,water_type)
     3504          ENDIF
     3505
    35073506          IF ( z0q_water == 9999999.9_wp )  THEN
    3508              z0q_water = water_pars(ind_w_z0h,water_type)       
    3509           ENDIF 
     3507             z0q_water = water_pars(ind_w_z0h,water_type)
     3508          ENDIF
    35103509
    35113510          IF ( albedo_type == 9999999  .AND.  albedo == 9999999.9_wp )  THEN
    3512              albedo_type = INT(water_pars(ind_w_at,water_type))       
    3513           ENDIF
    3514    
     3511             albedo_type = INT(water_pars(ind_w_at,water_type))
     3512          ENDIF
     3513
    35153514          IF ( emissivity == 9999999.9_wp )  THEN
    3516              emissivity = water_pars(ind_w_emis,water_type)       
    3517           ENDIF
    3518 
    3519        ENDIF 
     3515             emissivity = water_pars(ind_w_emis,water_type)
     3516          ENDIF
     3517
     3518       ENDIF
    35203519!
    35213520!--    Map values onto horizontal elemements
     
    35283527             surf_lsm_h%z0q(m)              = z0q_water
    35293528             surf_lsm_h%lambda_surface_s(m) = 1.0E10_wp
    3530              surf_lsm_h%lambda_surface_u(m) = 1.0E10_wp               
     3529             surf_lsm_h%lambda_surface_u(m) = 1.0E10_wp
    35313530             surf_lsm_h%c_surface(m)        = 0.0_wp
    35323531             surf_lsm_h%albedo_type(m,ind_wat_win) = albedo_type
    35333532             surf_lsm_h%emissivity(m,ind_wat_win)  = emissivity
    3534              
     3533
    35353534             surf_lsm_h%water_type(m)      = water_type
    35363535             surf_lsm_h%water_type_name(m) = water_type_name(water_type)
     
    35493548                surf_lsm_v(l)%z0q(m)              = z0q_water
    35503549                surf_lsm_v(l)%lambda_surface_s(m) = 1.0E10_wp
    3551                 surf_lsm_v(l)%lambda_surface_u(m) = 1.0E10_wp               
     3550                surf_lsm_v(l)%lambda_surface_u(m) = 1.0E10_wp
    35523551                surf_lsm_v(l)%c_surface(m)        = 0.0_wp
    35533552                surf_lsm_v(l)%albedo_type(m,ind_wat_win) = albedo_type
    35543553                surf_lsm_v(l)%emissivity(m,ind_wat_win)  = emissivity
    3555                
     3554
    35563555                surf_lsm_v(l)%water_type(m)      = water_type
    35573556                surf_lsm_v(l)%water_type_name(m) = water_type_name(water_type)
    3558              ENDIF 
     3557             ENDIF
    35593558          ENDDO
    35603559       ENDDO
     
    35623561!
    35633562!--    Level 2, initialization of water parameters via water_type read
    3564 !--    from file. Water surfaces are initialized for each (y,x)-grid point 
     3563!--    from file. Water surfaces are initialized for each (y,x)-grid point
    35653564!--    individually using default paramter settings according to the given
    35663565!--    water type.
     
    35733572             i = surf_lsm_h%i(m)
    35743573             j = surf_lsm_h%j(m)
    3575              
     3574
    35763575             st = water_type_f%var(j,i)
    35773576             IF ( st /= water_type_f%fill  .AND.  st /= 0 )  THEN
     
    35823581                surf_lsm_h%z0q(m)    = water_pars(ind_w_z0h,st)
    35833582                surf_lsm_h%lambda_surface_s(m) = water_pars(ind_w_lambda_s,st)
    3584                 surf_lsm_h%lambda_surface_u(m) = water_pars(ind_w_lambda_u,st)             
     3583                surf_lsm_h%lambda_surface_u(m) = water_pars(ind_w_lambda_u,st)
    35853584                surf_lsm_h%c_surface(m)        = 0.0_wp
    35863585                surf_lsm_h%albedo_type(m,ind_wat_win) = INT( water_pars(ind_w_at,st) )
    35873586                surf_lsm_h%emissivity(m,ind_wat_win)  = water_pars(ind_w_emis,st)
    3588                
     3587
    35893588                surf_lsm_h%water_type(m)      = st
    35903589                surf_lsm_h%water_type_name(m) = water_type_name(st)
     
    35963595             DO  m = 1, surf_lsm_v(l)%ns
    35973596                i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,         &
    3598                                                 surf_lsm_v(l)%building_covered(m) ) 
     3597                                                surf_lsm_v(l)%building_covered(m) )
    35993598                j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,         &
    3600                                                 surf_lsm_v(l)%building_covered(m) ) 
    3601              
     3599                                                surf_lsm_v(l)%building_covered(m) )
     3600
    36023601                st = water_type_f%var(j,i)
    36033602                IF ( st /= water_type_f%fill  .AND.  st /= 0 )  THEN
     
    36103609                                                   water_pars(ind_w_lambda_s,st)
    36113610                   surf_lsm_v(l)%lambda_surface_u(m) =                         &
    3612                                                    water_pars(ind_w_lambda_u,st)           
     3611                                                   water_pars(ind_w_lambda_u,st)
    36133612                   surf_lsm_v(l)%c_surface(m)     = 0.0_wp
    36143613                   surf_lsm_v(l)%albedo_type(m,ind_wat_win) =                  &
     
    36163615                   surf_lsm_v(l)%emissivity(m,ind_wat_win)  =                  &
    36173616                                                  water_pars(ind_w_emis,st)
    3618                                                  
     3617
    36193618                   surf_lsm_v(l)%water_type(m)      = st
    36203619                   surf_lsm_v(l)%water_type_name(m) = water_type_name(st)
     
    36223621             ENDDO
    36233622          ENDDO
    3624        ENDIF     
    3625 
    3626 !
    3627 !--    Level 3, initialization of water parameters at single (x,y) 
     3623       ENDIF
     3624
     3625!
     3626!--    Level 3, initialization of water parameters at single (x,y)
    36283627!--    position via water_pars read from file.
    36293628       IF ( water_pars_f%from_file )  THEN
    36303629!
    3631 !--       Horizontal surfaces 
     3630!--       Horizontal surfaces
    36323631          DO  m = 1, surf_lsm_h%ns
    36333632             i = surf_lsm_h%i(m)
    36343633             j = surf_lsm_h%j(m)
    36353634!
    3636 !--          If surface element is not a water surface and any value in 
     3635!--          If surface element is not a water surface and any value in
    36373636!--          water_pars is given, neglect this information and give an
    3638 !--          informative message that this value will not be used.   
     3637!--          informative message that this value will not be used.
    36393638             IF ( .NOT. surf_lsm_h%water_surface(m)  .AND.                     &
    36403639                   ANY( water_pars_f%pars_xy(:,j,i) /= water_pars_f%fill ) )  THEN
     
    36433642                              j, i, ') is not a water surface, ',              &
    36443643                              'so that information given in ',                 &
    3645                               'water_pars at this point is neglected.' 
     3644                              'water_pars at this point is neglected.'
    36463645                CALL message( 'land_surface_model_mod', 'PA0645', 0, 0, myid, 6, 0 )
    36473646             ELSE
     
    36673666                      water_pars_f%fill )                                      &
    36683667                   surf_lsm_h%lambda_surface_u(m) =                            &
    3669                                         water_pars_f%pars_xy(ind_w_lambda_u,j,i)     
    3670        
     3668                                        water_pars_f%pars_xy(ind_w_lambda_u,j,i)
     3669
    36713670                IF ( water_pars_f%pars_xy(ind_w_at,j,i) /=                     &
    36723671                     water_pars_f%fill )                                       &
     
    36773676                     water_pars_f%fill )                                       &
    36783677                   surf_lsm_h%emissivity(m,ind_wat_win) =                      &
    3679                                           water_pars_f%pars_xy(ind_w_emis,j,i) 
     3678                                          water_pars_f%pars_xy(ind_w_emis,j,i)
    36803679             ENDIF
    36813680          ENDDO
    36823681!
    3683 !--       Vertical surfaces 
     3682!--       Vertical surfaces
    36843683          DO  l = 0, 3
    36853684             DO  m = 1, surf_lsm_v(l)%ns
    36863685                i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,         &
    3687                                                 surf_lsm_v(l)%building_covered(m) ) 
     3686                                                surf_lsm_v(l)%building_covered(m) )
    36883687                j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,         &
    3689                                                 surf_lsm_v(l)%building_covered(m) ) 
    3690 !
    3691 !--             If surface element is not a water surface and any value in 
     3688                                                surf_lsm_v(l)%building_covered(m) )
     3689!
     3690!--             If surface element is not a water surface and any value in
    36923691!--             water_pars is given, neglect this information and give an
    3693 !--             informative message that this value will not be used.   
     3692!--             informative message that this value will not be used.
    36943693                IF ( .NOT. surf_lsm_v(l)%water_surface(m)  .AND.               &
    36953694                      ANY( water_pars_f%pars_xy(:,j,i) /=                      &
     
    36993698                              j, i, ') is not a water surface, ',              &
    37003699                              'so that information given in ',                 &
    3701                               'water_pars at this point is neglected.' 
     3700                              'water_pars at this point is neglected.'
    37023701                   CALL message( 'land_surface_model_mod', 'PA0645',           &
    37033702                                  0, 0, myid, 6, 0 )
     
    37273726                        water_pars_f%fill )                                    &
    37283727                      surf_lsm_v(l)%lambda_surface_u(m) =                      &
    3729                                       water_pars_f%pars_xy(ind_w_lambda_u,j,i)   
    3730  
     3728                                      water_pars_f%pars_xy(ind_w_lambda_u,j,i)
     3729
    37313730                   IF ( water_pars_f%pars_xy(ind_w_at,j,i) /=                  &
    37323731                        water_pars_f%fill )                                    &
     
    37373736                        water_pars_f%fill )                                    &
    37383737                      surf_lsm_v(l)%emissivity(m,ind_wat_win)  =               &
    3739                                       water_pars_f%pars_xy(ind_w_emis,j,i) 
     3738                                      water_pars_f%pars_xy(ind_w_emis,j,i)
    37403739                ENDIF
    37413740             ENDDO
     
    37453744!
    37463745!--    Initialize pavement-type surfaces, level 1
    3747        IF ( pavement_type /= 0 )  THEN 
    3748 
    3749 !
    3750 !--       When a pavement_type is used, overwrite a possible setting of 
     3746       IF ( pavement_type /= 0 )  THEN
     3747
     3748!
     3749!--       When a pavement_type is used, overwrite a possible setting of
    37513750!--       the pavement depth as it is already defined by the pavement type
    37523751          pavement_depth_level = 0
    37533752
    37543753          IF ( z0_pavement == 9999999.9_wp )  THEN
    3755              z0_pavement  = pavement_pars(ind_p_z0,pavement_type) 
     3754             z0_pavement  = pavement_pars(ind_p_z0,pavement_type)
    37563755          ENDIF
    37573756
     
    37593758             z0h_pavement = pavement_pars(ind_p_z0h,pavement_type)
    37603759          ENDIF
    3761          
     3760
    37623761          IF ( z0q_pavement == 9999999.9_wp )  THEN
    37633762             z0q_pavement = pavement_pars(ind_p_z0h,pavement_type)
     
    37703769          IF ( pavement_heat_capacity == 9999999.9_wp )  THEN
    37713770             pavement_heat_capacity = pavement_subsurface_pars_2(0,pavement_type)
    3772           ENDIF   
    3773    
     3771          ENDIF
     3772
    37743773          IF ( albedo_type == 9999999  .AND.  albedo == 9999999.9_wp )  THEN
    3775              albedo_type = INT(pavement_pars(ind_p_at,pavement_type))       
    3776           ENDIF
    3777    
     3774             albedo_type = INT(pavement_pars(ind_p_at,pavement_type))
     3775          ENDIF
     3776
    37783777          IF ( emissivity == 9999999.9_wp )  THEN
    3779              emissivity = pavement_pars(ind_p_emis,pavement_type)       
     3778             emissivity = pavement_pars(ind_p_emis,pavement_type)
    37803779          ENDIF
    37813780
     
    37843783!--       lookup table.
    37853784          IF ( pavement_depth_level == 0 )  THEN
    3786              DO  k = nzb_soil, nzt_soil 
     3785             DO  k = nzb_soil, nzt_soil
    37873786                IF ( pavement_subsurface_pars_1(k,pavement_type) == 9999999.9_wp &
    37883787                .OR. pavement_subsurface_pars_2(k,pavement_type) == 9999999.9_wp)&
     
    37983797       ENDIF
    37993798!
    3800 !--    Level 1 initialization of pavement type surfaces. Horizontally 
     3799!--    Level 1 initialization of pavement type surfaces. Horizontally
    38013800!--    homogeneous characteristics are assumed
    38023801       surf_lsm_h%nzt_pavement = pavement_depth_level
     
    38093808             surf_lsm_h%lambda_surface_s(m)    = pavement_heat_conduct         &
    38103809                                                  * ddz_soil(nzb_soil)         &
    3811                                                   * 2.0_wp   
     3810                                                  * 2.0_wp
    38123811             surf_lsm_h%lambda_surface_u(m)    = pavement_heat_conduct         &
    38133812                                                  * ddz_soil(nzb_soil)         &
    3814                                                   * 2.0_wp           
     3813                                                  * 2.0_wp
    38153814             surf_lsm_h%c_surface(m)           = pavement_heat_capacity        &
    38163815                                                        * dz_soil(nzb_soil)    &
    3817                                                         * 0.25_wp                                   
     3816                                                        * 0.25_wp
    38183817
    38193818             surf_lsm_h%albedo_type(m,ind_pav_green) = albedo_type
    3820              surf_lsm_h%emissivity(m,ind_pav_green)  = emissivity     
    3821              
     3819             surf_lsm_h%emissivity(m,ind_pav_green)  = emissivity
     3820
    38223821             surf_lsm_h%pavement_type(m)      = pavement_type
    38233822             surf_lsm_h%pavement_type_name(m) = pavement_type_name(pavement_type)
    3824      
     3823
    38253824             IF ( pavement_type /= 0 )  THEN
    38263825                DO  k = nzb_soil, surf_lsm_h%nzt_pavement(m)
    38273826                   surf_lsm_h%lambda_h_def(k,m)    =                           &
    3828                                      pavement_subsurface_pars_1(k,pavement_type)                       
     3827                                     pavement_subsurface_pars_1(k,pavement_type)
    38293828                   surf_lsm_h%rho_c_total_def(k,m) =                           &
    3830                                      pavement_subsurface_pars_2(k,pavement_type) 
     3829                                     pavement_subsurface_pars_2(k,pavement_type)
    38313830                ENDDO
    38323831             ELSE
    38333832                surf_lsm_h%lambda_h_def(:,m)     = pavement_heat_conduct
    38343833                surf_lsm_h%rho_c_total_def(:,m)  = pavement_heat_capacity
    3835              ENDIF       
    3836           ENDIF
    3837        ENDDO                               
     3834             ENDIF
     3835          ENDIF
     3836       ENDDO
    38383837
    38393838       DO  l = 0, 3
     
    38473846                surf_lsm_v(l)%lambda_surface_s(m)    = pavement_heat_conduct   &
    38483847                                                  * ddz_soil(nzb_soil)         &
    3849                                                   * 2.0_wp   
     3848                                                  * 2.0_wp
    38503849                surf_lsm_v(l)%lambda_surface_u(m)    = pavement_heat_conduct   &
    38513850                                                  * ddz_soil(nzb_soil)         &
    3852                                                   * 2.0_wp           
     3851                                                  * 2.0_wp
    38533852                surf_lsm_v(l)%c_surface(m)           = pavement_heat_capacity  &
    38543853                                                        * dz_soil(nzb_soil)    &
    3855                                                         * 0.25_wp                                     
     3854                                                        * 0.25_wp
    38563855
    38573856                surf_lsm_v(l)%albedo_type(m,ind_pav_green) = albedo_type
    38583857                surf_lsm_v(l)%emissivity(m,ind_pav_green)  = emissivity
    3859                
     3858
    38603859                surf_lsm_v(l)%pavement_type(m)      = pavement_type
    38613860                surf_lsm_v(l)%pavement_type_name(m) = pavement_type_name(pavement_type)
     
    38643863                   DO  k = nzb_soil, surf_lsm_v(l)%nzt_pavement(m)
    38653864                      surf_lsm_v(l)%lambda_h_def(k,m)    =                     &
    3866                                      pavement_subsurface_pars_1(k,pavement_type)                       
     3865                                     pavement_subsurface_pars_1(k,pavement_type)
    38673866                      surf_lsm_v(l)%rho_c_total_def(k,m) =                     &
    3868                                      pavement_subsurface_pars_2(k,pavement_type) 
     3867                                     pavement_subsurface_pars_2(k,pavement_type)
    38693868                   ENDDO
    38703869                ELSE
    38713870                   surf_lsm_v(l)%lambda_h_def(:,m)     = pavement_heat_conduct
    38723871                   surf_lsm_v(l)%rho_c_total_def(:,m)  = pavement_heat_capacity
    3873                 ENDIF     
     3872                ENDIF
    38743873             ENDIF
    38753874          ENDDO
     
    38773876!
    38783877!--    Level 2 initialization of pavement type surfaces via pavement_type read
    3879 !--    from file. Pavement surfaces are initialized for each (y,x)-grid point 
     3878!--    from file. Pavement surfaces are initialized for each (y,x)-grid point
    38803879!--    individually.
    38813880       IF ( pavement_type_f%from_file )  THEN
     
    38853884             i = surf_lsm_h%i(m)
    38863885             j = surf_lsm_h%j(m)
    3887              
     3886
    38883887             st = pavement_type_f%var(j,i)
    38893888             IF ( st /= pavement_type_f%fill  .AND.  st /= 0 )  THEN
    38903889!
    38913890!--             Determine deepmost index of pavement layer
    3892                 DO  k = nzb_soil, nzt_soil 
     3891                DO  k = nzb_soil, nzt_soil
    38933892                   IF ( pavement_subsurface_pars_1(k,st) == 9999999.9_wp       &
    38943893                   .OR. pavement_subsurface_pars_2(k,st) == 9999999.9_wp)      &
     
    39063905                                              pavement_subsurface_pars_1(0,st) &
    39073906                                                  * ddz_soil(nzb_soil)         &
    3908                                                   * 2.0_wp   
     3907                                                  * 2.0_wp
    39093908                surf_lsm_h%lambda_surface_u(m)  =                              &
    39103909                                              pavement_subsurface_pars_1(0,st) &
    39113910                                                  * ddz_soil(nzb_soil)         &
    3912                                                   * 2.0_wp       
     3911                                                  * 2.0_wp
    39133912                surf_lsm_h%c_surface(m)         =                              &
    39143913                                               pavement_subsurface_pars_2(0,st)&
    39153914                                                        * dz_soil(nzb_soil)    &
    3916                                                         * 0.25_wp                               
     3915                                                        * 0.25_wp
    39173916                surf_lsm_h%albedo_type(m,ind_pav_green) = INT( pavement_pars(ind_p_at,st) )
    3918                 surf_lsm_h%emissivity(m,ind_pav_green)  = pavement_pars(ind_p_emis,st) 
    3919                
     3917                surf_lsm_h%emissivity(m,ind_pav_green)  = pavement_pars(ind_p_emis,st)
     3918
    39203919                surf_lsm_h%pavement_type(m)      = st
    39213920                surf_lsm_h%pavement_type_name(m) = pavement_type_name(st)
     
    39233922                DO  k = nzb_soil, surf_lsm_h%nzt_pavement(m)
    39243923                   surf_lsm_h%lambda_h_def(k,m)    =                           &
    3925                                      pavement_subsurface_pars_1(k,pavement_type)                       
     3924                                     pavement_subsurface_pars_1(k,pavement_type)
    39263925                   surf_lsm_h%rho_c_total_def(k,m) =                           &
    3927                                      pavement_subsurface_pars_2(k,pavement_type) 
    3928                 ENDDO   
     3926                                     pavement_subsurface_pars_2(k,pavement_type)
     3927                ENDDO
    39293928             ENDIF
    39303929          ENDDO
     
    39343933             DO  m = 1, surf_lsm_v(l)%ns
    39353934                i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,         &
    3936                                                 surf_lsm_v(l)%building_covered(m) ) 
     3935                                                surf_lsm_v(l)%building_covered(m) )
    39373936                j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,         &
    3938                                                 surf_lsm_v(l)%building_covered(m) ) 
    3939              
     3937                                                surf_lsm_v(l)%building_covered(m) )
     3938
    39403939                st = pavement_type_f%var(j,i)
    39413940                IF ( st /= pavement_type_f%fill  .AND.  st /= 0 )  THEN
    39423941!
    39433942!--                Determine deepmost index of pavement layer
    3944                    DO  k = nzb_soil, nzt_soil 
     3943                   DO  k = nzb_soil, nzt_soil
    39453944                      IF ( pavement_subsurface_pars_1(k,st) == 9999999.9_wp    &
    39463945                      .OR. pavement_subsurface_pars_2(k,st) == 9999999.9_wp)   &
     
    39573956                   surf_lsm_v(l)%lambda_surface_s(m)  =                        &
    39583957                                              pavement_subsurface_pars_1(0,st) &
    3959                                                   * ddz_soil(nzb_soil)         & 
    3960                                                   * 2.0_wp   
     3958                                                  * ddz_soil(nzb_soil)         &
     3959                                                  * 2.0_wp
    39613960                   surf_lsm_v(l)%lambda_surface_u(m)  =                        &
    39623961                                              pavement_subsurface_pars_1(0,st) &
    39633962                                                  * ddz_soil(nzb_soil)         &
    3964                                                   * 2.0_wp     
     3963                                                  * 2.0_wp
    39653964
    39663965                   surf_lsm_v(l)%c_surface(m)    =                             &
    39673966                                           pavement_subsurface_pars_2(0,st)    &
    39683967                                                        * dz_soil(nzb_soil)    &
    3969                                                         * 0.25_wp                                   
     3968                                                        * 0.25_wp
    39703969                   surf_lsm_v(l)%albedo_type(m,ind_pav_green) =                &
    39713970                                              INT( pavement_pars(ind_p_at,st) )
    39723971                   surf_lsm_v(l)%emissivity(m,ind_pav_green)  =                &
    3973                                               pavement_pars(ind_p_emis,st) 
    3974                                              
     3972                                              pavement_pars(ind_p_emis,st)
     3973
    39753974                   surf_lsm_v(l)%pavement_type(m)      = st
    39763975                   surf_lsm_v(l)%pavement_type_name(m) = pavement_type_name(st)
    3977                                              
     3976
    39783977                   DO  k = nzb_soil, surf_lsm_v(l)%nzt_pavement(m)
    39793978                      surf_lsm_v(l)%lambda_h_def(k,m)    =                     &
    3980                                     pavement_subsurface_pars_1(k,pavement_type)                       
     3979                                    pavement_subsurface_pars_1(k,pavement_type)
    39813980                      surf_lsm_v(l)%rho_c_total_def(k,m) =                     &
    3982                                     pavement_subsurface_pars_2(k,pavement_type) 
    3983                    ENDDO   
     3981                                    pavement_subsurface_pars_2(k,pavement_type)
     3982                   ENDDO
    39843983                ENDIF
    39853984             ENDDO
    39863985          ENDDO
    3987        ENDIF 
    3988 !
    3989 !--    Level 3, initialization of pavement parameters at single (x,y) 
     3986       ENDIF
     3987!
     3988!--    Level 3, initialization of pavement parameters at single (x,y)
    39903989!--    position via pavement_pars read from file.
    39913990       IF ( pavement_pars_f%from_file )  THEN
    39923991!
    3993 !--       Horizontal surfaces 
     3992!--       Horizontal surfaces
    39943993          DO  m = 1, surf_lsm_h%ns
    39953994             i = surf_lsm_h%i(m)
    39963995             j = surf_lsm_h%j(m)
    39973996!
    3998 !--          If surface element is not a pavement surface and any value in 
     3997!--          If surface element is not a pavement surface and any value in
    39993998!--          pavement_pars is given, neglect this information and give an
    4000 !--          informative message that this value will not be used.   
     3999!--          informative message that this value will not be used.
    40014000             IF ( .NOT. surf_lsm_h%pavement_surface(m)  .AND.                  &
    40024001                   ANY( pavement_pars_f%pars_xy(:,j,i) /=                      &
     
    40064005                              j, i, ') is not a pavement surface, ',           &
    40074006                              'so that information given in ',                 &
    4008                               'pavement_pars at this point is neglected.' 
     4007                              'pavement_pars at this point is neglected.'
    40094008                CALL message( 'land_surface_model_mod', 'PA0647', 0, 0, myid, 6, 0 )
    40104009             ELSE
     
    40264025                      pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,0,j,i)&
    40274026                                                  * ddz_soil(nzb_soil)         &
    4028                                                   * 2.0_wp   
     4027                                                  * 2.0_wp
    40294028                ENDIF
    40304029                IF ( pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,0,j,i) /= &
     
    40334032                      pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,0,j,i)   &
    40344033                                                  * dz_soil(nzb_soil)          &
    4035                                                   * 0.25_wp                                   
     4034                                                  * 0.25_wp
    40364035                ENDIF
    40374036                IF ( pavement_pars_f%pars_xy(ind_p_at,j,i) /=                  &
     
    40434042                   surf_lsm_h%emissivity(m,ind_pav_green)  =                   &
    40444043                                   pavement_pars_f%pars_xy(ind_p_emis,j,i)
    4045              ENDIF 
     4044             ENDIF
    40464045
    40474046          ENDDO
    40484047!
    4049 !--       Vertical surfaces 
     4048!--       Vertical surfaces
    40504049          DO  l = 0, 3
    40514050             DO  m = 1, surf_lsm_v(l)%ns
    40524051                i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,         &
    4053                                                 surf_lsm_v(l)%building_covered(m) ) 
     4052                                                surf_lsm_v(l)%building_covered(m) )
    40544053                j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,         &
    4055                                                 surf_lsm_v(l)%building_covered(m) ) 
    4056 !
    4057 !--             If surface element is not a pavement surface and any value in 
     4054                                                surf_lsm_v(l)%building_covered(m) )
     4055!
     4056!--             If surface element is not a pavement surface and any value in
    40584057!--             pavement_pars is given, neglect this information and give an
    4059 !--             informative message that this value will not be used.   
     4058!--             informative message that this value will not be used.
    40604059                IF ( .NOT. surf_lsm_v(l)%pavement_surface(m)  .AND.            &
    40614060                      ANY( pavement_pars_f%pars_xy(:,j,i) /=                   &
     
    40654064                                 j, i, ') is not a pavement surface, ',        &
    40664065                                 'so that information given in ',              &
    4067                                  'pavement_pars at this point is neglected.' 
     4066                                 'pavement_pars at this point is neglected.'
    40684067                   CALL message( 'land_surface_model_mod', 'PA0647', 0, 0, myid, 6, 0 )
    40694068                ELSE
     
    40864085                      pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,0,j,i)&
    40874086                                                  * ddz_soil(nzb_soil)         &
    4088                                                   * 2.0_wp   
     4087                                                  * 2.0_wp
    40894088                   ENDIF
    40904089                   IF ( pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,0,j,i) &
     
    40934092                         pavement_subsurface_pars_f%pars_xyz(ind_p_rho_c,0,j,i)&
    40944093                                                  * dz_soil(nzb_soil)          &
    4095                                                   * 0.25_wp                                 
     4094                                                  * 0.25_wp
    40964095                   ENDIF
    40974096                   IF ( pavement_pars_f%pars_xy(ind_p_at,j,i) /=               &
     
    41034102                        pavement_pars_f%fill )                                 &
    41044103                      surf_lsm_v(l)%emissivity(m,ind_pav_green)  =             &
    4105                                    pavement_pars_f%pars_xy(ind_p_emis,j,i) 
    4106                 ENDIF 
     4104                                   pavement_pars_f%pars_xy(ind_p_emis,j,i)
     4105                ENDIF
    41074106             ENDDO
    41084107          ENDDO
    41094108       ENDIF
    41104109!
    4111 !--    Moreover, for grid points which are flagged with pavement-type 0 or whre 
    4112 !--    pavement_subsurface_pars_f is provided, soil heat conductivity and 
    4113 !--    capacity are initialized with parameters given in       
    4114 !--    pavement_subsurface_pars read from file. 
     4110!--    Moreover, for grid points which are flagged with pavement-type 0 or whre
     4111!--    pavement_subsurface_pars_f is provided, soil heat conductivity and
     4112!--    capacity are initialized with parameters given in
     4113!--    pavement_subsurface_pars read from file.
    41154114       IF ( pavement_subsurface_pars_f%from_file )  THEN
    41164115!
    4117 !--       Set pavement depth to nzt_soil. Please note, this is just a 
    4118 !--       workaround at the moment. 
     4116!--       Set pavement depth to nzt_soil. Please note, this is just a
     4117!--       workaround at the moment.
    41194118          DO  m = 1, surf_lsm_h%ns
    41204119             IF ( surf_lsm_h%pavement_surface(m) )  THEN
     
    41254124                surf_lsm_h%nzt_pavement(m) = nzt_soil
    41264125
    4127                 DO  k = nzb_soil, nzt_soil 
     4126                DO  k = nzb_soil, nzt_soil
    41284127                   surf_lsm_h%lambda_h_def(k,m) =                              &
    41294128                       pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,k,j,i)
     
    41394138
    41404139                   i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,      &
    4141                                                 surf_lsm_v(l)%building_covered(m) ) 
     4140                                                surf_lsm_v(l)%building_covered(m) )
    41424141                   j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,      &
    4143                                                 surf_lsm_v(l)%building_covered(m) ) 
     4142                                                surf_lsm_v(l)%building_covered(m) )
    41444143
    41454144                   surf_lsm_v(l)%nzt_pavement(m) = nzt_soil
    41464145
    4147                    DO  k = nzb_soil, nzt_soil 
     4146                   DO  k = nzb_soil, nzt_soil
    41484147                      surf_lsm_v(l)%lambda_h_def(k,m) =                        &
    41494148                       pavement_subsurface_pars_f%pars_xyz(ind_p_lambda_h,k,j,i)
     
    41614160       IF (  TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
    41624161!
    4163 !--       First, initialize soil temperature and moisture. 
    4164 !--       According to the initialization for surface and soil parameters, 
    4165 !--       initialize soil moisture and temperature via a level approach. This 
    4166 !--       is to assure that all surface elements are initialized, even if 
     4162!--       First, initialize soil temperature and moisture.
     4163!--       According to the initialization for surface and soil parameters,
     4164!--       initialize soil moisture and temperature via a level approach. This
     4165!--       is to assure that all surface elements are initialized, even if
    41674166!--       data provided from input file contains fill values at some locations.
    41684167!--       Level 1, initialization via profiles given in parameter file
     
    41704169             IF ( surf_lsm_h%vegetation_surface(m)  .OR.                       &
    41714170                  surf_lsm_h%pavement_surface(m) )  THEN
    4172                 DO  k = nzb_soil, nzt_soil 
     4171                DO  k = nzb_soil, nzt_soil
    41734172                   t_soil_h%var_2d(k,m) = soil_temperature(k)
    41744173                   m_soil_h%var_2d(k,m) = soil_moisture(k)
     
    41814180                IF ( surf_lsm_v(l)%vegetation_surface(m)  .OR.                 &
    41824181                     surf_lsm_v(l)%pavement_surface(m) )  THEN
    4183                    DO  k = nzb_soil, nzt_soil 
     4182                   DO  k = nzb_soil, nzt_soil
    41844183                      t_soil_v(l)%var_2d(k,m) = soil_temperature(k)
    41854184                      m_soil_v(l)%var_2d(k,m) = soil_moisture(k)
     
    41904189          ENDDO
    41914190!
    4192 !--       Level 2 initialization of the soil, read soil properties from 
    4193 !--       dynamic input file. 
     4191!--       Level 2 initialization of the soil, read soil properties from
     4192!--       dynamic input file.
    41944193          IF ( input_pids_dynamic )  THEN
    41954194!
     
    42084207             ALLOCATE( vars_pids(1:num_var_pids) )
    42094208             CALL inquire_variable_names( pids_id, vars_pids )
    4210 !           
    4211 !--          Read vertical dimension for soil depth. 
     4209!
     4210!--          Read vertical dimension for soil depth.
    42124211             IF ( check_existence( vars_pids, 'zsoil' ) )                      &
    42134212                CALL get_dimension_length( pids_id, init_3d%nzs, 'zsoil' )
    4214 !           
     4213!
    42154214!--          Read also the horizontal dimensions required for soil initialization.
    4216 !--          Please note, in case of non-nested runs or in case of root domain, 
     4215!--          Please note, in case of non-nested runs or in case of root domain,
    42174216!--          these data is already available, but will be read again for the sake
    4218 !--          of clearness. 
     4217!--          of clearness.
    42194218             CALL get_dimension_length( pids_id, init_3d%nx, 'x'  )
    42204219             CALL get_dimension_length( pids_id, init_3d%ny, 'y'  )
    4221 !           
     4220!
    42224221!--          Check for correct horizontal and vertical dimension. Please note,
    4223 !--          in case of non-nested runs or in case of root domain, these checks 
     4222!--          in case of non-nested runs or in case of root domain, these checks
    42244223!--          are already performed
    42254224             IF ( init_3d%nx-1 /= nx  .OR.  init_3d%ny-1 /= ny )  THEN
     
    42294228                CALL message( 'lsm_init', 'PA0543', 1, 2, 0, 6, 0 )
    42304229             ENDIF
    4231 !           
     4230!
    42324231!--          Read vertical dimensions. Later, these are required for eventual
    42334232!--          inter- and extrapolations of the initialization data.
     
    42364235                CALL get_variable( pids_id, 'zsoil', init_3d%z_soil )
    42374236             ENDIF
    4238 !           
     4237!
    42394238!--          Read initial data for soil moisture
    42404239             IF ( check_existence( vars_pids, 'init_soil_m' ) )  THEN
    4241 !           
     4240!
    42424241!--             Read attributes for the fill value and level-of-detail
    42434242                CALL get_attribute( pids_id, char_fill,                        &
     
    42474246                                    init_3d%lod_msoil,                         &
    42484247                                    .FALSE., 'init_soil_m' )
    4249 !           
     4248!
    42504249!--             level-of-detail 1 - read initialization profile
    42514250                IF ( init_3d%lod_msoil == 1 )  THEN
    42524251                   ALLOCATE( init_3d%msoil_1d(0:init_3d%nzs-1) )
    4253            
     4252
    42544253                   CALL get_variable( pids_id, 'init_soil_m',                  &
    42554254                                      init_3d%msoil_1d(0:init_3d%nzs-1) )
    4256 !           
     4255!
    42574256!--             level-of-detail 2 - read 3D initialization data
    42584257                ELSEIF ( init_3d%lod_msoil == 2 )  THEN
    42594258                   ALLOCATE ( init_3d%msoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr) )
    4260            
    4261                   CALL get_variable( pids_id, 'init_soil_m',                   &   
     4259
     4260                  CALL get_variable( pids_id, 'init_soil_m',                   &
    42624261                             init_3d%msoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr),&
    42634262                             nxl, nxr, nys, nyn, 0, init_3d%nzs-1 )
    4264            
     4263
    42654264                ENDIF
    42664265                init_3d%from_file_msoil = .TRUE.
    42674266             ENDIF
    4268 !           
     4267!
    42694268!--          Read soil temperature
    42704269             IF ( check_existence( vars_pids, 'init_soil_t' ) )  THEN
    4271 !           
     4270!
    42724271!--             Read attributes for the fill value and level-of-detail
    42734272                CALL get_attribute( pids_id, char_fill,                        &
     
    42774276                                    init_3d%lod_tsoil,                         &
    42784277                                    .FALSE., 'init_soil_t' )
    4279 !           
     4278!
    42804279!--             level-of-detail 1 - read initialization profile
    42814280                IF ( init_3d%lod_tsoil == 1 )  THEN
    42824281                   ALLOCATE( init_3d%tsoil_1d(0:init_3d%nzs-1) )
    4283            
     4282
    42844283                   CALL get_variable( pids_id, 'init_soil_t',                  &
    42854284                                      init_3d%tsoil_1d(0:init_3d%nzs-1) )
    4286            
    4287 !           
     4285
     4286!
    42884287!--             level-of-detail 2 - read 3D initialization data
    42894288                ELSEIF ( init_3d%lod_tsoil == 2 )  THEN
    42904289                   ALLOCATE ( init_3d%tsoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr) )
    4291                    
    4292                    CALL get_variable( pids_id, 'init_soil_t',                  &   
     4290
     4291                   CALL get_variable( pids_id, 'init_soil_t',                  &
    42934292                             init_3d%tsoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr),&
    42944293                             nxl, nxr, nys, nyn, 0, init_3d%nzs-1 )
     
    42964295                init_3d%from_file_tsoil = .TRUE.
    42974296             ENDIF
    4298 !           
     4297!
    42994298!--          Close the input file and deallocate temporary arrays
    43004299             DEALLOCATE( vars_pids )
    43014300
    43024301             CALL close_input_file( pids_id )
    4303 #endif     
    4304 !           
     4302#endif
     4303!
    43054304!--          End of CPU measurement
    43064305             CALL cpu_log( log_point_s(85), 'NetCDF input init', 'stop' )
    43074306          ENDIF
    43084307!
    4309 !--       In case no dynamic input is available for a child domain but the 
    4310 !--       parent is initialized with dynamic input file, the different soil 
    4311 !--       states can lead to significant discrepancies in the atmospheric 
     4308!--       In case no dynamic input is available for a child domain but the
     4309!--       parent is initialized with dynamic input file, the different soil
     4310!--       states can lead to significant discrepancies in the atmospheric
    43124311!--       surface forcing. For this reason, the child domain is initialized with
    43134312!--       domain-averaged soil profiles from the root domain, even if
    4314 !--       no initialization with inifor is set. Note, as long as a dynamic 
     4313!--       no initialization with inifor is set. Note, as long as a dynamic
    43154314!--       input file with soil information is available for the child domain,
    43164315!--       the input file information will be used.
     
    43184317#if defined( __parallel )
    43194318!
    4320 !--          Check if soil moisture and temperature in the root model are 
    4321 !--          initialized from dynamic input. This case, distribute these 
     4319!--          Check if soil moisture and temperature in the root model are
     4320!--          initialized from dynamic input. This case, distribute these
    43224321!--          information to its child domain(s).
    43234322             IF ( pmc_is_rootmodel() )  THEN
    4324                 init_msoil_from_driver_root = init_3d%from_file_msoil 
     4323                init_msoil_from_driver_root = init_3d%from_file_msoil
    43254324                init_tsoil_from_driver_root = init_3d%from_file_tsoil
    43264325             ENDIF
     
    43314330                             0, MPI_COMM_WORLD, ierr )
    43324331!
    4333 !--          In case of a nested run, first average the soil profiles in the 
     4332!--          In case of a nested run, first average the soil profiles in the
    43344333!--          root domain.
    43354334             IF ( init_msoil_from_driver_root  .OR.                            &
     
    43384337                IF ( pmc_is_rootmodel() )  THEN
    43394338!
    4340 !--                Child domains will be only initialized with horizontally 
    4341 !--                averaged soil profiles in parent domain (for sake of simplicity). 
    4342 !--                If required, average soil data on root parent domain before the 
     4339!--                Child domains will be only initialized with horizontally
     4340!--                averaged soil profiles in parent domain (for sake of simplicity).
     4341!--                If required, average soil data on root parent domain before the
    43434342!--                soil profiles are distributed onto the child domains.
    43444343!--                Start with soil moisture.
     
    43494348                         pr_soil_init(k) = SUM( init_3d%msoil_3d(k,nys:nyn,nxl:nxr)  )
    43504349                      ENDDO
    4351 !               
    4352 !--                   Allocate 1D array for soil-moisture profile (will not be 
    4353 !--                   allocated in lod==2 case). 
     4350!
     4351!--                   Allocate 1D array for soil-moisture profile (will not be
     4352!--                   allocated in lod==2 case).
    43544353                      ALLOCATE( init_3d%msoil_1d(0:init_3d%nzs-1) )
    43554354                      init_3d%msoil_1d = 0.0_wp
     
    43574356                                          SIZE(pr_soil_init),                  &
    43584357                                          MPI_REAL, MPI_SUM, comm2d, ierr )
    4359                
     4358
    43604359                      init_3d%msoil_1d = init_3d%msoil_1d /                    &
    43614360                                        REAL( ( nx + 1 ) * ( ny + 1), KIND=wp )
    43624361                      DEALLOCATE( pr_soil_init )
    43634362                   ENDIF
    4364 !               
     4363!
    43654364!--                Proceed with soil temperature.
    43664365                   IF ( init_3d%from_file_tsoil  .AND.                         &
    43674366                        init_3d%lod_tsoil == 2 )  THEN
    43684367                      ALLOCATE( pr_soil_init(0:init_3d%nzs-1) )
    4369                
     4368
    43704369                      DO  k = 0, init_3d%nzs-1
    43714370                         pr_soil_init(k) = SUM( init_3d%tsoil_3d(k,nys:nyn,nxl:nxr)  )
    43724371                      ENDDO
    4373 !               
    4374 !--                   Allocate 1D array for soil-temperature profile (will not be 
    4375 !--                   allocated in lod==2 case). 
     4372!
     4373!--                   Allocate 1D array for soil-temperature profile (will not be
     4374!--                   allocated in lod==2 case).
    43764375                      ALLOCATE( init_3d%tsoil_1d(0:init_3d%nzs-1) )
    43774376                      init_3d%tsoil_1d = 0.0_wp
     
    43824381                                        REAL( ( nx + 1 ) * ( ny + 1), KIND=wp )
    43834382                      DEALLOCATE( pr_soil_init )
    4384                
     4383
    43854384                   ENDIF
    43864385                ENDIF
    4387 !               
    4388 !--             Broadcast number of soil layers in root model to all childs. 
    4389 !--             Note, only process 0 in COMM_WORLD is sending. 
     4386!
     4387!--             Broadcast number of soil layers in root model to all childs.
     4388!--             Note, only process 0 in COMM_WORLD is sending.
    43904389                IF ( pmc_is_rootmodel() )  nzs_root = init_3d%nzs
    4391                
     4390
    43924391                CALL MPI_BCAST( nzs_root, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr )
    4393 !               
    4394 !--             Allocate dummy arrays for soil moisture and temperature profiles 
    4395 !--             on all domains.             
     4392!
     4393!--             Allocate dummy arrays for soil moisture and temperature profiles
     4394!--             on all domains.
    43964395                ALLOCATE( z_soil_root(1:nzs_root)   )
    43974396                IF ( init_msoil_from_driver_root )                             &
     
    44214420!
    44224421!--             In the following, the child domains decide whether they take
    4423 !--             the information from the root domain or not. 
     4422!--             the information from the root domain or not.
    44244423                IF ( .NOT. pmc_is_rootmodel() )  THEN
    4425 !               
     4424!
    44264425!--                If soil moisture or temperature isn't in dynamic input file for
    4427 !--                the child, take the information provided from the root model. 
     4426!--                the child, take the information provided from the root model.
    44284427!--                Start with z-dimension
    44294428                   IF ( .NOT. init_3d%from_file_msoil  .OR.                    &
     
    44334432                      init_3d%z_soil(1:init_3d%nzs) = z_soil_root
    44344433                   ENDIF
    4435 !                 
    4436 !--                Take soil moisture. Note, control flags from_file... and LoD 
    4437 !--                need to be set. 
     4434!
     4435!--                Take soil moisture. Note, control flags from_file... and LoD
     4436!--                need to be set.
    44384437                   IF ( .NOT. init_3d%from_file_msoil )  THEN
    44394438                      ALLOCATE( init_3d%msoil_1d(0:init_3d%nzs-1) )
    44404439                      init_3d%lod_msoil = 1
    44414440                      init_3d%from_file_msoil = .TRUE.
    4442                      
    4443                       init_3d%msoil_1d = m_soil_root             
     4441
     4442                      init_3d%msoil_1d = m_soil_root
    44444443                   ENDIF
    4445 !                 
    4446 !--                Take soil temperature. Note, control flags from_file... and LoD 
    4447 !--                need to be set. 
     4444!
     4445!--                Take soil temperature. Note, control flags from_file... and LoD
     4446!--                need to be set.
    44484447                   IF (  .NOT. init_3d%from_file_tsoil )  THEN
    44494448                      ALLOCATE( init_3d%tsoil_1d(0:init_3d%nzs-1) )
    44504449                      init_3d%lod_tsoil = 1
    44514450                      init_3d%from_file_tsoil = .TRUE.
    4452                      
    4453                       init_3d%tsoil_1d = t_soil_root 
     4451
     4452                      init_3d%tsoil_1d = t_soil_root
    44544453                   ENDIF
    44554454                ENDIF
    4456                
     4455
    44574456                DEALLOCATE( z_soil_root )
    44584457                DEALLOCATE( m_soil_root )
     
    44624461          ENDIF
    44634462!
    4464 !--       Proceed with Level 2 initialization. 
     4463!--       Proceed with Level 2 initialization.
    44654464          IF ( init_3d%from_file_msoil )  THEN
    44664465
     
    45164515!--                      input do not need to be checked whether a grid point
    45174516!--                      is building covered. This is because soil data in the
    4518 !--                      dynamic input is provided for the whole domain. 
     4517!--                      dynamic input is provided for the whole domain.
    45194518                         i = surf_lsm_v(l)%i(m)
    45204519                         j = surf_lsm_v(l)%j(m)
    4521                          
     4520
    45224521                         IF ( init_3d%msoil_3d(0,j,i) /= init_3d%fill_msoil )  &
    45234522                            CALL interpolate_soil_profile(                     &
     
    45754574                      i = surf_lsm_h%i(m)
    45764575                      j = surf_lsm_h%j(m)
    4577                      
     4576
    45784577                      IF ( init_3d%tsoil_3d(0,j,i) /= init_3d%fill_tsoil )     &
    45794578                         CALL interpolate_soil_profile(                        &
     
    45964595!--                      input do not need to be checked whether a grid point
    45974596!--                      is building covered. This is because soil data in the
    4598 !--                      dynamic input is provided for the whole domain. 
     4597!--                      dynamic input is provided for the whole domain.
    45994598                         i = surf_lsm_v(l)%i(m)
    46004599                         j = surf_lsm_v(l)%j(m)
    4601                          
     4600
    46024601                         IF ( init_3d%tsoil_3d(0,j,i) /= init_3d%fill_tsoil )  &
    46034602                            CALL interpolate_soil_profile(                     &
     
    46174616          ENDIF
    46184617!
    4619 !--       After soil moisture and temperature are finally initialized, check 
    4620 !--       if soil moisture is higher than its saturation value. If this would 
    4621 !--       be the case, the soil model parametrization will produce floating 
     4618!--       After soil moisture and temperature are finally initialized, check
     4619!--       if soil moisture is higher than its saturation value. If this would
     4620!--       be the case, the soil model parametrization will produce floating
    46224621!--       point errors. Hence, limit the soil moisture to its saturation value
    4623 !--       and give a warning. 
     4622!--       and give a warning.
    46244623          DO  m = 1, surf_lsm_h%ns
    46254624             IF ( surf_lsm_h%vegetation_surface(m)  .OR.                       &
     
    46334632                            'thus limited to this value to maintain stability.'
    46344633                      CALL message( 'lsm_init', 'PA0458', 0, 1, myid, 6, 0 )
    4635                    ENDIF               
     4634                   ENDIF
    46364635                ENDDO
    46374636             ENDIF
     
    46514650                            ' and is ' //                                      &
    46524651                            'thus limited to this value to maintain stability.'
    4653                          CALL message( 'lsm_init', 'PA0458', 0, 1, myid, 6, 0 )                   
     4652                         CALL message( 'lsm_init', 'PA0458', 0, 1, myid, 6, 0 )
    46544653                      ENDIF
    46554654                   ENDDO
     
    46624661          DO  m = 1, surf_lsm_h%ns
    46634662
    4664              i   = surf_lsm_h%i(m)           
     4663             i   = surf_lsm_h%i(m)
    46654664             j   = surf_lsm_h%j(m)
    46664665             k   = surf_lsm_h%k(m)
     
    46704669             t_surface_h%var_1d(m)    = t_soil_h%var_2d(nzb_soil,m)
    46714670             surf_lsm_h%pt_surface(m) = t_soil_h%var_2d(nzb_soil,m) / exner(nzb)
    4672              
     4671
    46734672             IF ( bulk_cloud_model  .OR. cloud_droplets ) THEN
    46744673                surf_lsm_h%pt1(m) = pt(k,j,i) + lv_d_cp * d_exner(k) * ql(k,j,i)
    46754674             ELSE
    46764675                surf_lsm_h%pt1(m) = pt(k,j,i)
    4677              ENDIF 
     4676             ENDIF
    46784677!
    46794678!--          Assure that r_a cannot be zero at model start
     
    46914690          DO  l = 0, 3
    46924691             DO  m = 1, surf_lsm_v(l)%ns
    4693                 i   = surf_lsm_v(l)%i(m)           
     4692                i   = surf_lsm_v(l)%i(m)
    46944693                j   = surf_lsm_v(l)%j(m)
    4695                 k   = surf_lsm_v(l)%k(m)         
     4694                k   = surf_lsm_v(l)%k(m)
    46964695!
    46974696!--             Initialize surface temperature with soil temperature in the uppermost
     
    47044703                ELSE
    47054704                   surf_lsm_v(l)%pt1(m) = pt(k,j,i)
    4706                 ENDIF 
     4705                ENDIF
    47074706
    47084707!
     
    47114710                     surf_lsm_v(l)%pt1(m) = surf_lsm_v(l)%pt1(m) + 1.0E-20_wp
    47124711!
    4713 !--             Set artifical values for ts and us so that r_a has its initial value 
     4712!--             Set artifical values for ts and us so that r_a has its initial value
    47144713!--             for the first time step. Only for interior core domain, not for ghost points
    47154714                surf_lsm_v(l)%us(m)   = 0.1_wp
     
    47984797!--       Map calculated root fractions
    47994798          DO  m = 1, surf_lsm_h%ns
    4800              DO  k = nzb_soil, nzt_soil 
     4799             DO  k = nzb_soil, nzt_soil
    48014800                IF ( surf_lsm_h%pavement_surface(m)  .AND.                     &
    48024801                     k <= surf_lsm_h%nzt_pavement(m) )  THEN
     
    48084807             ENDDO
    48094808!
    4810 !--          Normalize so that the sum = 1. Only relevant when the root         
     4809!--          Normalize so that the sum = 1. Only relevant when the root
    48114810!--          distribution was set to zero due to pavement at some layers.
    48124811             IF ( SUM( surf_lsm_h%root_fr(:,m) ) > 0.0_wp )  THEN
     
    48284827                ENDDO
    48294828!
    4830 !--             Normalize so that the sum = 1. Only relevant when the root     
     4829!--             Normalize so that the sum = 1. Only relevant when the root
    48314830!--             distribution was set to zero due to pavement at some layers.
    48324831                IF ( SUM( surf_lsm_v(l)%root_fr(:,m) ) > 0.0_wp )  THEN
    4833                    DO  k = nzb_soil, nzt_soil 
     4832                   DO  k = nzb_soil, nzt_soil
    48344833                      surf_lsm_v(l)%root_fr(k,m) = surf_lsm_v(l)%root_fr(k,m)  &
    48354834                      / SUM( surf_lsm_v(l)%root_fr(:,m) )
     
    48464845             IF ( surf_lsm_h%vegetation_surface(m) )  THEN
    48474846                i = surf_lsm_h%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,            &
    4848                                              surf_lsm_v(l)%building_covered(m) ) 
     4847                                             surf_lsm_v(l)%building_covered(m) )
    48494848                j = surf_lsm_h%j(m) + MERGE( 0, surf_lsm_v(l)%joff,            &
    4850                                              surf_lsm_v(l)%building_covered(m) ) 
    4851                 DO  k = nzb_soil, nzt_soil 
    4852                    surf_lsm_h%root_fr(k,m) = root_area_density_lsm_f%var(k,j,i) 
     4849                                             surf_lsm_v(l)%building_covered(m) )
     4850                DO  k = nzb_soil, nzt_soil
     4851                   surf_lsm_h%root_fr(k,m) = root_area_density_lsm_f%var(k,j,i)
    48534852                ENDDO
    48544853
     
    48604859                IF ( surf_lsm_v(l)%vegetation_surface(m) )  THEN
    48614860                   i = surf_lsm_v(l)%i(m) + MERGE( 0, surf_lsm_v(l)%ioff,      &
    4862                                                    surf_lsm_v(l)%building_covered(m) ) 
     4861                                                   surf_lsm_v(l)%building_covered(m) )
    48634862                   j = surf_lsm_v(l)%j(m) + MERGE( 0, surf_lsm_v(l)%joff,      &
    4864                                                    surf_lsm_v(l)%building_covered(m) ) 
    4865 
    4866                    DO  k = nzb_soil, nzt_soil 
    4867                       surf_lsm_v(l)%root_fr(k,m) = root_area_density_lsm_f%var(k,j,i) 
     4863                                                   surf_lsm_v(l)%building_covered(m) )
     4864
     4865                   DO  k = nzb_soil, nzt_soil
     4866                      surf_lsm_v(l)%root_fr(k,m) = root_area_density_lsm_f%var(k,j,i)
    48684867                   ENDDO
    48694868
     
    48734872
    48744873       ENDIF
    4875  
     4874
    48764875!
    48774876!--    Possibly do user-defined actions (e.g. define heterogeneous land surface)
     
    48804879
    48814880!
    4882 !--    Calculate new roughness lengths (for water surfaces only, i.e. only 
     4881!--    Calculate new roughness lengths (for water surfaces only, i.e. only
    48834882!-     horizontal surfaces)
    48844883       IF ( .NOT. constant_roughness )  CALL calc_z0_water_surface
     
    48964895
    48974896
    4898 !--    Store initial profiles of t_soil and m_soil (assuming they are 
     4897!--    Store initial profiles of t_soil and m_soil (assuming they are
    48994898!--    horizontally homogeneous on this PE)
    49004899!--    DEACTIVATED FOR NOW - leads to error when number of locations with
     
    49024901!        hom(nzb_soil:nzt_soil,1,90,:)  = SPREAD( t_soil_h%var_2d(nzb_soil:nzt_soil,1),  &
    49034902!                                                 2, statistic_regions+1 )
    4904 !        hom(nzb_soil:nzt_soil,1,92,:)  = SPREAD( m_soil_h%var_2d(nzb_soil:nzt_soil,1),  & 
     4903!        hom(nzb_soil:nzt_soil,1,92,:)  = SPREAD( m_soil_h%var_2d(nzb_soil:nzt_soil,1),  &
    49054904!                                                 2, statistic_regions+1 )
    49064905
    49074906!
    4908 !--    Finally, make some consistency checks. 
     4907!--    Finally, make some consistency checks.
    49094908!--    Ceck for illegal combination of LAI and vegetation coverage.
    49104909       IF ( ANY( .NOT. surf_lsm_h%pavement_surface  .AND.                      &
     
    49264925       ENDDO
    49274926!
    4928 !--    Check if roughness length for momentum, heat, or moisture exceed 
    4929 !--    surface-layer height and decrease local roughness length where 
     4927!--    Check if roughness length for momentum, heat, or moisture exceed
     4928!--    surface-layer height and decrease local roughness length where
    49304929!--    necessary. This case, give an informative message. Note, to avoid
    49314930!--    that the job-protocoll is messed-up, this message is only given once.
     
    50115010!------------------------------------------------------------------------------!
    50125011    SUBROUTINE lsm_init_arrays
    5013    
     5012
    50145013
    50155014       IMPLICIT NONE
    50165015
    5017        INTEGER(iwp) ::  l !< index indicating facing of surface array 
    5018    
     5016       INTEGER(iwp) ::  l !< index indicating facing of surface array
     5017
    50195018       ALLOCATE ( root_extr(nzb_soil:nzt_soil) )
    5020        root_extr = 0.0_wp 
    5021        
    5022 !
    5023 !--    Allocate surface and soil temperature / humidity. Please note, 
     5019       root_extr = 0.0_wp
     5020
     5021!
     5022!--    Allocate surface and soil temperature / humidity. Please note,
    50245023!--    these arrays are allocated according to surface-data structure,
    5025 !--    even if they do not belong to the data type due to the 
    5026 !--    pointer arithmetric (TARGET attribute is not allowed in a data-type). 
     5024!--    even if they do not belong to the data type due to the
     5025!--    pointer arithmetric (TARGET attribute is not allowed in a data-type).
    50275026!
    50285027!--    Horizontal surfaces
     
    50635062       ALLOCATE ( tt_surface_h_m%var_1d(1:surf_lsm_h%ns)                 )
    50645063       ALLOCATE ( tm_soil_h_m%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h%ns)  )
    5065        ALLOCATE ( tt_soil_h_m%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h%ns)  ) 
     5064       ALLOCATE ( tt_soil_h_m%var_2d(nzb_soil:nzt_soil,1:surf_lsm_h%ns)  )
    50665065!
    50675066!--    Horizontal surfaces
     
    50715070          ALLOCATE ( tm_soil_v_m(l)%var_2d(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns)  )
    50725071          ALLOCATE ( tt_soil_v_m(l)%var_2d(nzb_soil:nzt_soil,1:surf_lsm_v(l)%ns)  )
    5073        ENDDO 
     5072       ENDDO
    50745073
    50755074!
     
    50915090       ALLOCATE ( surf_lsm_h%qsws_liq(1:surf_lsm_h%ns)            )
    50925091       ALLOCATE ( surf_lsm_h%qsws_veg(1:surf_lsm_h%ns)            )
    5093        ALLOCATE ( surf_lsm_h%rad_net_l(1:surf_lsm_h%ns)           ) 
     5092       ALLOCATE ( surf_lsm_h%rad_net_l(1:surf_lsm_h%ns)           )
    50945093       ALLOCATE ( surf_lsm_h%r_a(1:surf_lsm_h%ns)                 )
    50955094       ALLOCATE ( surf_lsm_h%r_canopy(1:surf_lsm_h%ns)            )
     
    51035102       surf_lsm_h%water_surface        = .FALSE.
    51045103       surf_lsm_h%pavement_surface     = .FALSE.
    5105        surf_lsm_h%vegetation_surface   = .FALSE. 
     5104       surf_lsm_h%vegetation_surface   = .FALSE.
    51065105
    51075106!
     
    51395138          surf_lsm_v(l)%water_surface       = .FALSE.
    51405139          surf_lsm_v(l)%pavement_surface    = .FALSE.
    5141           surf_lsm_v(l)%vegetation_surface  = .FALSE. 
    5142          
     5140          surf_lsm_v(l)%vegetation_surface  = .FALSE.
     5141
    51435142
    51445143!
    51455144!--       Set default values
    51465145          surf_lsm_v(l)%r_canopy_min = 0.0_wp
    5147        
     5146
    51485147       ENDDO
    51495148
     
    51785177       IMPLICIT NONE
    51795178
    5180        CHARACTER (LEN=80) ::  line  !< dummy string that contains the current line of the parameter file 
    5181        
     5179       CHARACTER (LEN=80) ::  line  !< dummy string that contains the current line of the parameter file
     5180
    51825181       NAMELIST /lsm_par/         alpha_vangenuchten, c_surface,               &
    51835182                                  canopy_resistance_coefficient,               &
     
    51865185                                  deep_soil_temperature,                       &
    51875186                                  dz_soil,                                     &
    5188                                   f_shortwave_incoming, field_capacity,        & 
     5187                                  f_shortwave_incoming, field_capacity,        &
    51895188                                  aero_resist_kray, hydraulic_conductivity,    &
    51905189                                  lambda_surface_stable,                       &
     
    52145213                                  deep_soil_temperature,                       &
    52155214                                  dz_soil,                                     &
    5216                                   f_shortwave_incoming, field_capacity,        & 
     5215                                  f_shortwave_incoming, field_capacity,        &
    52175216                                  aero_resist_kray, hydraulic_conductivity,    &
    52185217                                  lambda_surface_stable,                       &
     
    52345233                                  z0h_water, z0q_water, z0_pavement,           &
    52355234                                  z0h_pavement, z0q_pavement
    5236                                  
     5235
    52375236       line = ' '
    5238  
     5237
    52395238!
    52405239!--    Try to find land surface model package
     
    52535252!--    Set flag that indicates that the land surface model is switched on
    52545253       land_surface = .TRUE.
    5255        
     5254
    52565255       GOTO 14
    52575256
     
    52765275                     'land_surface_parameters instead'
    52775276       CALL message( 'lsm_parin', 'PA0487', 0, 1, 0, 6, 0 )
    5278        
     5277
    52795278!
    52805279!--    Set flag that indicates that the land surface model is switched on
    52815280       land_surface = .TRUE.
    5282        
     5281
    52835282       GOTO 14
    52845283
     
    52895288
    52905289 14    CONTINUE
    5291        
     5290
    52925291
    52935292    END SUBROUTINE lsm_parin
     
    53635362                IF ( surf%pavement_surface(m)  .AND.                           &
    53645363                     k <= surf%nzt_pavement(m) )  THEN
    5365                    
     5364
    53665365                   surf%rho_c_total(k,m) = surf%rho_c_total_def(k,m)
    5367                    lambda_temp(k)        = surf%lambda_h_def(k,m) 
    5368 
    5369                 ELSE           
    5370 !
    5371 !--                Calculate volumetric heat capacity of the soil, taking 
    5372 !--                into account water content 
     5366                   lambda_temp(k)        = surf%lambda_h_def(k,m)
     5367
     5368                ELSE
     5369!
     5370!--                Calculate volumetric heat capacity of the soil, taking
     5371!--                into account water content
    53735372                   surf%rho_c_total(k,m) = (rho_c_soil *                       &
    53745373                                               ( 1.0_wp - surf%m_sat(k,m) )    &
     
    53905389
    53915390!
    5392 !--          Calculate soil heat conductivity (lambda_h) at the _layer level 
     5391!--          Calculate soil heat conductivity (lambda_h) at the _layer level
    53935392!--          using linear interpolation. For pavement surface, the
    53945393!--          true pavement depth is considered
     
    54235422                                       surf_t_soil%var_2d(nzb_soil:nzt_soil,m) &
    54245423                                               + dt_3d * ( tsc(2)              &
    5425                                                * tend(nzb_soil:nzt_soil)       & 
     5424                                               * tend(nzb_soil:nzt_soil)       &
    54265425                                               + tsc(3)                        &
    54275426                                               * surf_tt_soil_m%var_2d(nzb_soil:nzt_soil,m) )
     
    54485447
    54495448!
    5450 !--             In order to prevent water tranport through paved surfaces, 
     5449!--             In order to prevent water tranport through paved surfaces,
    54515450!--             conductivity and diffusivity are set to zero
    54525451                IF ( surf%pavement_surface(m)  .AND.                           &
     
    54545453                   lambda_temp(k) = 0.0_wp
    54555454                   gamma_temp(k)  = 0.0_wp
    5456    
    5457                 ELSE 
    5458    
     5455
     5456                ELSE
     5457
    54595458!
    54605459!--                Calculate soil diffusivity at the center of the soil layers
     
    55005499                IF ( humidity )  THEN
    55015500!
    5502 !--                Calculate soil diffusivity (lambda_w) at the _layer level 
     5501!--                Calculate soil diffusivity (lambda_w) at the _layer level
    55035502!--                using linear interpolation. To do: replace this with
    55045503!--                ECMWF-IFS Eq. 8.81
    55055504                   DO  k = nzb_soil, nzt_soil-1
    5506                
     5505
    55075506                      surf%lambda_w(k,m) = ( lambda_temp(k+1) + lambda_temp(k) )  &
    55085507                                           * 0.5_wp
    55095508                      surf%gamma_w(k,m)  = ( gamma_temp(k+1)  +  gamma_temp(k) )  &
    55105509                                           * 0.5_wp
    5511                                            
     5510
    55125511                   ENDDO
    55135512!
    55145513!
    5515 !--                In case of a closed bottom (= water content is conserved), 
    5516 !--                set hydraulic conductivity to zero to that no water will be 
     5514!--                In case of a closed bottom (= water content is conserved),
     5515!--                set hydraulic conductivity to zero to that no water will be
    55175516!--                lost in the bottom layer. As gamma_w is always a positive value,
    55185517!--                it cannot be set to zero in case of purely dry soil since this
     
    55255524                   ELSE
    55265525                      surf%gamma_w(nzt_soil,m) = gamma_temp(nzt_soil)
    5527                    ENDIF     
    5528 
    5529 !--                The root extraction (= root_extr * qsws_veg / (rho_l     
    5530 !--                * l_v)) ensures the mass conservation for water. The         
    5531 !--                transpiration of plants equals the cumulative withdrawals by 
    5532 !--                the roots in the soil. The scheme takes into account the 
    5533 !--                availability of water in the soil layers as well as the root 
    5534 !--                fraction in the respective layer. Layer with moisture below 
    5535 !--                wilting point will not contribute, which reflects the 
     5526                   ENDIF
     5527
     5528!--                The root extraction (= root_extr * qsws_veg / (rho_l
     5529!--                * l_v)) ensures the mass conservation for water. The
     5530!--                transpiration of plants equals the cumulative withdrawals by
     5531!--                the roots in the soil. The scheme takes into account the
     5532!--                availability of water in the soil layers as well as the root
     5533!--                fraction in the respective layer. Layer with moisture below
     5534!--                wilting point will not contribute, which reflects the
    55365535!--                preference of plants to take water from moister layers.
    55375536!
    5538 !--                Calculate the root extraction (ECMWF 7.69, the sum of 
    5539 !--                root_extr = 1). The energy balance solver guarantees a 
    5540 !--                positive transpiration, so that there is no need for an 
     5537!--                Calculate the root extraction (ECMWF 7.69, the sum of
     5538!--                root_extr = 1). The energy balance solver guarantees a
     5539!--                positive transpiration, so that there is no need for an
    55415540!--                additional check.
    55425541                   m_total = 0.0_wp
     
    55465545                                * surf_m_soil%var_2d(k,m)
    55475546                      ENDIF
    5548                    ENDDO 
     5547                   ENDDO
    55495548                   IF ( m_total > 0.0_wp )  THEN
    55505549                      DO  k = nzb_soil, nzt_soil
     
    55875586                                   root_extr(nzt_soil)                         &
    55885587                                   * surf%qsws_veg(m) * drho_l_lv )            &
    5589                                   ) * ddz_soil(nzt_soil)             
     5588                                  ) * ddz_soil(nzt_soil)
    55905589
    55915590                   surf_m_soil_p%var_2d(nzb_soil:nzt_soil,m) =                 &
    55925591                                       surf_m_soil%var_2d(nzb_soil:nzt_soil,m) &
    55935592                                         + dt_3d * ( tsc(2) * tend(:)          &
    5594                                          + tsc(3) * surf_tm_soil_m%var_2d(:,m) )   
    5595    
     5593                                         + tsc(3) * surf_tm_soil_m%var_2d(:,m) )
     5594
    55965595!
    55975596!--                Account for dry and wet soils to keep solution stable
     
    55995598                   DO  k = nzb_soil, nzt_soil
    56005599                      surf_m_soil_p%var_2d(k,m) = MIN( surf_m_soil_p%var_2d(k,m), surf%m_sat(k,m) )
    5601                       surf_m_soil_p%var_2d(k,m) = MAX( surf_m_soil_p%var_2d(k,m), 0.0_wp )                     
     5600                      surf_m_soil_p%var_2d(k,m) = MAX( surf_m_soil_p%var_2d(k,m), 0.0_wp )
    56025601                   ENDDO
    5603  
     5602
    56045603!
    56055604!--                Calculate m_soil tendencies for the next Runge-Kutta step
     
    56185617
    56195618                      ENDIF
    5620                      
     5619
    56215620                   ENDIF
    5622                    
     5621
    56235622                ENDIF
    56245623
     
    56385637    END SUBROUTINE lsm_soil_model
    56395638
    5640  
     5639
    56415640!------------------------------------------------------------------------------!
    56425641! Description:
     
    56505649       INTEGER, INTENT(IN) :: mod_count
    56515650
    5652    
     5651
    56535652       SELECT CASE ( mod_count )
    56545653
     
    57085707!------------------------------------------------------------------------------!
    57095708SUBROUTINE lsm_3d_data_averaging( mode, variable )
    5710  
     5709
    57115710
    57125711    USE control_parameters
     
    57165715    IMPLICIT NONE
    57175716
    5718     CHARACTER (LEN=*) ::  mode    !< 
    5719     CHARACTER (LEN=*) :: variable !< 
    5720 
    5721     INTEGER(iwp) ::  i       !< 
    5722     INTEGER(iwp) ::  j       !< 
    5723     INTEGER(iwp) ::  k       !< 
     5717    CHARACTER (LEN=*) ::  mode    !<
     5718    CHARACTER (LEN=*) :: variable !<
     5719
     5720    INTEGER(iwp) ::  i       !<
     5721    INTEGER(iwp) ::  j       !<
     5722    INTEGER(iwp) ::  k       !<
    57245723    INTEGER(iwp) ::  m       !< running index
    57255724
     
    58045803
    58055804          CASE ( 'c_liq*' )
    5806              IF ( ALLOCATED( c_liq_av ) ) THEN 
     5805             IF ( ALLOCATED( c_liq_av ) ) THEN
    58075806                DO  m = 1, surf_lsm_h%ns
    5808                    i   = surf_lsm_h%i(m)           
     5807                   i   = surf_lsm_h%i(m)
    58095808                   j   = surf_lsm_h%j(m)
    58105809                   c_liq_av(j,i) = c_liq_av(j,i) + surf_lsm_h%c_liq(m)
    58115810                ENDDO
    5812              ENDIF   
     5811             ENDIF
    58135812
    58145813          CASE ( 'c_soil*' )
    5815              IF ( ALLOCATED( c_soil_av ) ) THEN 
     5814             IF ( ALLOCATED( c_soil_av ) ) THEN
    58165815                DO  m = 1, surf_lsm_h%ns
    5817                    i   = surf_lsm_h%i(m)           
     5816                   i   = surf_lsm_h%i(m)
    58185817                   j   = surf_lsm_h%j(m)
    58195818                   c_soil_av(j,i) = c_soil_av(j,i) + (1.0 - surf_lsm_h%c_veg(m))
     
    58225821
    58235822          CASE ( 'c_veg*' )
    5824              IF ( ALLOCATED( c_veg_av ) ) THEN 
     5823             IF ( ALLOCATED( c_veg_av ) ) THEN
    58255824                DO  m = 1, surf_lsm_h%ns
    5826                    i   = surf_lsm_h%i(m)           
     5825                   i   = surf_lsm_h%i(m)
    58275826                   j   = surf_lsm_h%j(m)
    58285827                   c_veg_av(j,i) = c_veg_av(j,i) + surf_lsm_h%c_veg(m)
     
    58315830
    58325831          CASE ( 'lai*' )
    5833              IF ( ALLOCATED( lai_av ) ) THEN 
     5832             IF ( ALLOCATED( lai_av ) ) THEN
    58345833                DO  m = 1, surf_lsm_h%ns
    5835                    i   = surf_lsm_h%i(m)           
     5834                   i   = surf_lsm_h%i(m)
    58365835                   j   = surf_lsm_h%j(m)
    58375836                   lai_av(j,i) = lai_av(j,i) + surf_lsm_h%lai(m)
     
    58405839
    58415840          CASE ( 'm_liq*' )
    5842              IF ( ALLOCATED( m_liq_av ) ) THEN 
     5841             IF ( ALLOCATED( m_liq_av ) ) THEN
    58435842                DO  m = 1, surf_lsm_h%ns
    5844                    i   = surf_lsm_h%i(m)           
     5843                   i   = surf_lsm_h%i(m)
    58455844                   j   = surf_lsm_h%j(m)
    58465845                   m_liq_av(j,i) = m_liq_av(j,i) + m_liq_h%var_1d(m)
     
    58495848
    58505849          CASE ( 'm_soil' )
    5851              IF ( ALLOCATED( m_soil_av ) ) THEN 
     5850             IF ( ALLOCATED( m_soil_av ) ) THEN
    58525851                DO  m = 1, surf_lsm_h%ns
    5853                    i   = surf_lsm_h%i(m)           
     5852                   i   = surf_lsm_h%i(m)
    58545853                   j   = surf_lsm_h%j(m)
    58555854                   DO  k = nzb_soil, nzt_soil
     
    58605859
    58615860          CASE ( 'qsws_liq*' )
    5862              IF ( ALLOCATED( qsws_liq_av ) ) THEN 
     5861             IF ( ALLOCATED( qsws_liq_av ) ) THEN
    58635862                DO  m = 1, surf_lsm_h%ns
    5864                    i   = surf_lsm_h%i(m)           
     5863                   i   = surf_lsm_h%i(m)
    58655864                   j   = surf_lsm_h%j(m)
    58665865                   qsws_liq_av(j,i) = qsws_liq_av(j,i) +                       &
     
    58705869
    58715870          CASE ( 'qsws_soil*' )
    5872              IF ( ALLOCATED( qsws_soil_av ) ) THEN 
     5871             IF ( ALLOCATED( qsws_soil_av ) ) THEN
    58735872                DO  m = 1, surf_lsm_h%ns
    5874                    i   = surf_lsm_h%i(m)           
     5873                   i   = surf_lsm_h%i(m)
    58755874                   j   = surf_lsm_h%j(m)
    58765875                   qsws_soil_av(j,i) = qsws_soil_av(j,i) +                     &
     
    58805879
    58815880          CASE ( 'qsws_veg*' )
    5882              IF ( ALLOCATED(qsws_veg_av ) ) THEN 
     5881             IF ( ALLOCATED(qsws_veg_av ) ) THEN
    58835882                DO  m = 1, surf_lsm_h%ns
    5884                    i   = surf_lsm_h%i(m)           
     5883                   i   = surf_lsm_h%i(m)
    58855884                   j   = surf_lsm_h%j(m)
    58865885                   qsws_veg_av(j,i) = qsws_veg_av(j,i) +                       &
     
    58905889
    58915890          CASE ( 'r_s*' )
    5892              IF ( ALLOCATED( r_s_av) ) THEN 
     5891             IF ( ALLOCATED( r_s_av) ) THEN
    58935892                DO  m = 1, surf_lsm_h%ns
    5894                    i   = surf_lsm_h%i(m)           
     5893                   i   = surf_lsm_h%i(m)
    58955894                   j   = surf_lsm_h%j(m)
    58965895                   r_s_av(j,i) = r_s_av(j,i) + surf_lsm_h%r_s(m)
     
    58995898
    59005899          CASE ( 't_soil' )
    5901              IF ( ALLOCATED( t_soil_av ) ) THEN 
     5900             IF ( ALLOCATED( t_soil_av ) ) THEN
    59025901                DO  m = 1, surf_lsm_h%ns
    5903                    i   = surf_lsm_h%i(m)           
     5902                   i   = surf_lsm_h%i(m)
    59045903                   j   = surf_lsm_h%j(m)
    59055904                   DO  k = nzb_soil, nzt_soil
     
    59085907                ENDDO
    59095908             ENDIF
    5910              
     5909
    59115910          CASE DEFAULT
    59125911             CONTINUE
     
    60146013                DO  i = nxl, nxr
    60156014                   DO  j = nys, nyn
    6016                       r_s_av(j,i) = r_s_av(j,i)                                & 
     6015                      r_s_av(j,i) = r_s_av(j,i)                                &
    60176016                                    / REAL( average_count_3d, KIND=wp )
    60186017                   ENDDO
     
    60326031             ENDIF
    60336032!
    6034 !-- 
     6033!--
    60356034
    60366035       END SELECT
     
    60496048!------------------------------------------------------------------------------!
    60506049 SUBROUTINE lsm_define_netcdf_grid( var, found, grid_x, grid_y, grid_z )
    6051    
     6050
    60526051     IMPLICIT NONE
    60536052
    6054      CHARACTER (LEN=*), INTENT(IN)  ::  var         !< 
    6055      LOGICAL, INTENT(OUT)           ::  found       !< 
    6056      CHARACTER (LEN=*), INTENT(OUT) ::  grid_x      !< 
    6057      CHARACTER (LEN=*), INTENT(OUT) ::  grid_y      !< 
    6058      CHARACTER (LEN=*), INTENT(OUT) ::  grid_z      !< 
     6053     CHARACTER (LEN=*), INTENT(IN)  ::  var         !<
     6054     LOGICAL, INTENT(OUT)           ::  found       !<
     6055     CHARACTER (LEN=*), INTENT(OUT) ::  grid_x      !<
     6056     CHARACTER (LEN=*), INTENT(OUT) ::  grid_y      !<
     6057     CHARACTER (LEN=*), INTENT(OUT) ::  grid_z      !<
    60596058
    60606059     found  = .TRUE.
     
    60876086 SUBROUTINE lsm_data_output_2d( av, variable, found, grid, mode, local_pf,     &
    60886087                                two_d, nzb_do, nzt_do )
    6089  
     6088
    60906089    USE indices
    60916090
     
    60936092    IMPLICIT NONE
    60946093
    6095     CHARACTER (LEN=*) ::  grid     !< 
    6096     CHARACTER (LEN=*) ::  mode     !< 
    6097     CHARACTER (LEN=*) ::  variable !< 
    6098 
    6099     INTEGER(iwp) ::  av      !< 
    6100     INTEGER(iwp) ::  i       !< running index 
     6094    CHARACTER (LEN=*) ::  grid     !<
     6095    CHARACTER (LEN=*) ::  mode     !<
     6096    CHARACTER (LEN=*) ::  variable !<
     6097
     6098    INTEGER(iwp) ::  av      !<
     6099    INTEGER(iwp) ::  i       !< running index
    61016100    INTEGER(iwp) ::  j       !< running index
    61026101    INTEGER(iwp) ::  k       !< running index
    61036102    INTEGER(iwp) ::  m       !< running index
    6104     INTEGER(iwp) ::  nzb_do  !< 
    6105     INTEGER(iwp) ::  nzt_do  !< 
    6106 
    6107     LOGICAL      ::  found !< 
     6103    INTEGER(iwp) ::  nzb_do  !<
     6104    INTEGER(iwp) ::  nzt_do  !<
     6105
     6106    LOGICAL      ::  found !<
    61086107    LOGICAL      ::  two_d !< flag parameter that indicates 2D variables (horizontal cross sections)
    61096108
    61106109    REAL(wp) ::  fill_value = -999.0_wp    !< value for the _FillValue attribute
    61116110
    6112     REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !< 
     6111    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !<
    61136112
    61146113
     
    61176116    SELECT CASE ( TRIM( variable ) )
    61186117!
    6119 !--    Before data is transfered to local_pf, transfer is it 2D dummy variable and exchange ghost points therein. 
    6120 !--    However, at this point this is only required for instantaneous arrays, time-averaged quantities are already exchanged. 
     6118!--    Before data is transfered to local_pf, transfer is it 2D dummy variable and exchange ghost points therein.
     6119!--    However, at this point this is only required for instantaneous arrays, time-averaged quantities are already exchanged.
    61216120       CASE ( 'c_liq*_xy' )        ! 2d-array
    61226121          IF ( av == 0 )  THEN
    61236122             DO  m = 1, surf_lsm_h%ns
    6124                 i                   = surf_lsm_h%i(m)           
     6123                i                   = surf_lsm_h%i(m)
    61256124                j                   = surf_lsm_h%j(m)
    61266125                local_pf(i,j,nzb+1) = surf_lsm_h%c_liq(m) * surf_lsm_h%c_veg(m)
     
    61446143          IF ( av == 0 )  THEN
    61456144             DO  m = 1, surf_lsm_h%ns
    6146                 i                   = surf_lsm_h%i(m)           
     6145                i                   = surf_lsm_h%i(m)
    61476146                j                   = surf_lsm_h%j(m)
    61486147                local_pf(i,j,nzb+1) = 1.0_wp - surf_lsm_h%c_veg(m)
     
    61666165          IF ( av == 0 )  THEN
    61676166             DO  m = 1, surf_lsm_h%ns
    6168                 i                   = surf_lsm_h%i(m)           
     6167                i                   = surf_lsm_h%i(m)
    61696168                j                   = surf_lsm_h%j(m)
    61706169                local_pf(i,j,nzb+1) = surf_lsm_h%c_veg(m)
     
    61886187          IF ( av == 0 )  THEN
    61896188             DO  m = 1, surf_lsm_h%ns
    6190                 i                   = surf_lsm_h%i(m)           
     6189                i                   = surf_lsm_h%i(m)
    61916190                j                   = surf_lsm_h%j(m)
    61926191                local_pf(i,j,nzb+1) = surf_lsm_h%lai(m)
     
    62106209          IF ( av == 0 )  THEN
    62116210             DO  m = 1, surf_lsm_h%ns
    6212                 i                   = surf_lsm_h%i(m)           
     6211                i                   = surf_lsm_h%i(m)
    62136212                j                   = surf_lsm_h%j(m)
    62146213                local_pf(i,j,nzb+1) = m_liq_h%var_1d(m)
     
    62326231          IF ( av == 0 )  THEN
    62336232             DO  m = 1, surf_lsm_h%ns
    6234                 i   = surf_lsm_h%i(m)           
     6233                i   = surf_lsm_h%i(m)
    62356234                j   = surf_lsm_h%j(m)
    62366235                DO k = nzb_soil, nzt_soil
     
    62566255
    62576256          IF ( mode == 'xy' ) grid = 'zs'
    6258          
     6257
    62596258       CASE ( 'qsws_liq*_xy' )        ! 2d-array
    62606259          IF ( av == 0 ) THEN
    62616260             DO  m = 1, surf_lsm_h%ns
    6262                 i                   = surf_lsm_h%i(m)           
     6261                i                   = surf_lsm_h%i(m)
    62636262                j                   = surf_lsm_h%j(m)
    62646263                local_pf(i,j,nzb+1) = surf_lsm_h%qsws_liq(m)
     
    62706269            ENDIF
    62716270             DO  i = nxl, nxr
    6272                 DO  j = nys, nyn 
     6271                DO  j = nys, nyn
    62736272                   local_pf(i,j,nzb+1) =  qsws_liq_av(j,i)
    62746273                ENDDO
     
    62826281          IF ( av == 0 ) THEN
    62836282             DO  m = 1, surf_lsm_h%ns
    6284                 i                   = surf_lsm_h%i(m)           
     6283                i                   = surf_lsm_h%i(m)
    62856284                j                   = surf_lsm_h%j(m)
    62866285                local_pf(i,j,nzb+1) =  surf_lsm_h%qsws_soil(m)
     
    62926291            ENDIF
    62936292             DO  i = nxl, nxr
    6294                 DO  j = nys, nyn 
     6293                DO  j = nys, nyn
    62956294                   local_pf(i,j,nzb+1) =  qsws_soil_av(j,i)
    62966295                ENDDO
     
    63046303          IF ( av == 0 ) THEN
    63056304             DO  m = 1, surf_lsm_h%ns
    6306                 i                   = surf_lsm_h%i(m)           
     6305                i                   = surf_lsm_h%i(m)
    63076306                j                   = surf_lsm_h%j(m)
    63086307                local_pf(i,j,nzb+1) =  surf_lsm_h%qsws_veg(m)
     
    63146313            ENDIF
    63156314             DO  i = nxl, nxr
    6316                 DO  j = nys, nyn 
     6315                DO  j = nys, nyn
    63176316                   local_pf(i,j,nzb+1) =  qsws_veg_av(j,i)
    63186317                ENDDO
     
    63276326          IF ( av == 0 )  THEN
    63286327             DO  m = 1, surf_lsm_h%ns
    6329                 i                   = surf_lsm_h%i(m)           
     6328                i                   = surf_lsm_h%i(m)
    63306329                j                   = surf_lsm_h%j(m)
    63316330                local_pf(i,j,nzb+1) = surf_lsm_h%r_s(m)
     
    63496348          IF ( av == 0 )  THEN
    63506349             DO  m = 1, surf_lsm_h%ns
    6351                 i   = surf_lsm_h%i(m)           
     6350                i   = surf_lsm_h%i(m)
    63526351                j   = surf_lsm_h%j(m)
    63536352                DO k = nzb_soil, nzt_soil
     
    63806379
    63816380    END SELECT
    6382  
     6381
    63836382 END SUBROUTINE lsm_data_output_2d
    63846383
     
    63916390!------------------------------------------------------------------------------!
    63926391 SUBROUTINE lsm_data_output_3d( av, variable, found, local_pf )
    6393  
     6392
    63946393
    63956394    USE indices
     
    63986397    IMPLICIT NONE
    63996398
    6400     CHARACTER (LEN=*) ::  variable !< 
    6401 
    6402     INTEGER(iwp) ::  av    !< 
    6403     INTEGER(iwp) ::  i     !< 
    6404     INTEGER(iwp) ::  j     !< 
    6405     INTEGER(iwp) ::  k     !< 
     6399    CHARACTER (LEN=*) ::  variable !<
     6400
     6401    INTEGER(iwp) ::  av    !<
     6402    INTEGER(iwp) ::  i     !<
     6403    INTEGER(iwp) ::  j     !<
     6404    INTEGER(iwp) ::  k     !<
    64066405    INTEGER(iwp) ::  m     !< running index
    64076406
    6408     LOGICAL      ::  found !< 
     6407    LOGICAL      ::  found !<
    64096408
    64106409    REAL(wp) ::  fill_value = -999.0_wp    !< value for the _FillValue attribute
    64116410
    6412     REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_soil:nzt_soil) ::  local_pf !< 
     6411    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_soil:nzt_soil) ::  local_pf !<
    64136412
    64146413
     
    64246423         IF ( av == 0 )  THEN
    64256424            DO  m = 1, surf_lsm_h%ns
    6426                 i   = surf_lsm_h%i(m)           
     6425                i   = surf_lsm_h%i(m)
    64276426                j   = surf_lsm_h%j(m)
    64286427                DO  k = nzb_soil, nzt_soil
     
    64486447         IF ( av == 0 )  THEN
    64496448            DO  m = 1, surf_lsm_h%ns
    6450                i   = surf_lsm_h%i(m)           
     6449               i   = surf_lsm_h%i(m)
    64516450               j   = surf_lsm_h%j(m)
    64526451               DO  k = nzb_soil, nzt_soil
     
    64826481! Description:
    64836482! ------------
    6484 !> Write restart data for land surface model. It is necessary to write 
     6483!> Write restart data for land surface model. It is necessary to write
    64856484!> start_index and end_index several times.
    64866485!------------------------------------------------------------------------------!
    64876486 SUBROUTINE lsm_wrd_local
    6488        
     6487
    64896488
    64906489    IMPLICIT NONE
     
    65446543       WRITE ( 14 )  qsws_veg_av
    65456544    ENDIF
    6546    
     6545
    65476546    IF ( ALLOCATED( t_soil_av ) )  THEN
    65486547       CALL wrd_write_string( 't_soil_av' )
     
    65586557    CALL wrd_write_string( 't_soil_h' )
    65596558    WRITE ( 14 )  t_soil_h%var_2d
    6560        
    6561 
    6562        
     6559
     6560
     6561
    65636562    DO  l = 0, 3
    65646563
     
    65696568       WRITE ( 14 )  surf_lsm_v(l)%end_index
    65706569
    6571        WRITE( dum, '(I1)')  l   
     6570       WRITE( dum, '(I1)')  l
    65726571
    65736572       CALL wrd_write_string( 't_soil_v(' // dum // ')' )
    65746573       WRITE ( 14 )  t_soil_v(l)%var_2d
    6575              
     6574
    65766575    ENDDO
    65776576
     
    65936592       WRITE ( 14 )  surf_lsm_v(l)%end_index
    65946593
    6595        WRITE( dum, '(I1)')  l   
     6594       WRITE( dum, '(I1)')  l
    65966595
    65976596       CALL wrd_write_string( 'm_soil_v(' // dum // ')' )
    6598        WRITE ( 14 )  m_soil_v(l)%var_2d 
    6599      
     6597       WRITE ( 14 )  m_soil_v(l)%var_2d
     6598
    66006599    ENDDO
    66016600
     
    66086607    CALL wrd_write_string( 'm_liq_h' )
    66096608    WRITE ( 14 )  m_liq_h%var_1d
    6610        
     6609
    66116610    DO  l = 0, 3
    66126611
     
    66176616       WRITE ( 14 )  surf_lsm_v(l)%end_index
    66186617
    6619        WRITE( dum, '(I1)')  l   
     6618       WRITE( dum, '(I1)')  l
    66206619
    66216620       CALL wrd_write_string( 'm_liq_v(' // dum // ')' )
    6622        WRITE ( 14 )  m_liq_v(l)%var_1d     
    6623                
     6621       WRITE ( 14 )  m_liq_v(l)%var_1d
     6622
    66246623    ENDDO
    66256624
     
    66416640       WRITE ( 14 )  surf_lsm_v(l)%end_index
    66426641
    6643        WRITE( dum, '(I1)')  l   
     6642       WRITE( dum, '(I1)')  l
    66446643
    66456644       CALL wrd_write_string( 't_surface_v(' // dum // ')' )
    6646        WRITE ( 14 )  t_surface_v(l)%var_1d     
    6647        
     6645       WRITE ( 14 )  t_surface_v(l)%var_1d
     6646
    66486647    ENDDO
    66496648
     
    66616660                          nxr_on_file, nynf, nync, nyn_on_file, nysf, nysc,    &
    66626661                          nys_on_file, tmp_2d, found )
    6663  
     6662
    66646663
    66656664    USE control_parameters
    6666        
     6665
    66676666    USE indices
    6668    
     6667
    66696668    USE pegrid
    66706669
     
    66726671    IMPLICIT NONE
    66736672
    6674     INTEGER(iwp) ::  k                 !< 
     6673    INTEGER(iwp) ::  k                 !<
    66756674    INTEGER(iwp) ::  l                 !< running index surface orientation
    66766675    INTEGER(iwp) ::  ns_h_on_file_lsm  !< number of horizontal surface elements (natural type) on file
    6677     INTEGER(iwp) ::  nxlc              !< 
    6678     INTEGER(iwp) ::  nxlf              !< 
     6676    INTEGER(iwp) ::  nxlc              !<
     6677    INTEGER(iwp) ::  nxlf              !<
    66796678    INTEGER(iwp) ::  nxl_on_file       !< index of left boundary on former local domain
    6680     INTEGER(iwp) ::  nxrc              !< 
    6681     INTEGER(iwp) ::  nxrf              !< 
     6679    INTEGER(iwp) ::  nxrc              !<
     6680    INTEGER(iwp) ::  nxrf              !<
    66826681    INTEGER(iwp) ::  nxr_on_file       !< index of right boundary on former local domain
    6683     INTEGER(iwp) ::  nync              !< 
    6684     INTEGER(iwp) ::  nynf              !< 
     6682    INTEGER(iwp) ::  nync              !<
     6683    INTEGER(iwp) ::  nynf              !<
    66856684    INTEGER(iwp) ::  nyn_on_file       !< index of north boundary on former local domain
    6686     INTEGER(iwp) ::  nysc              !< 
    6687     INTEGER(iwp) ::  nysf              !< 
     6685    INTEGER(iwp) ::  nysc              !<
     6686    INTEGER(iwp) ::  nysf              !<
    66886687    INTEGER(iwp) ::  nys_on_file       !< index of south boundary on former local domain
    66896688
    66906689    INTEGER(iwp) ::  ns_v_on_file_lsm(0:3) !< number of vertical surface elements (natural type) on file
    66916690
    6692     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE, SAVE ::  start_index_on_file 
     6691    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE, SAVE ::  start_index_on_file
    66936692    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE, SAVE ::  end_index_on_file
    66946693
    66956694    LOGICAL, INTENT(OUT)  :: found
    66966695
    6697     REAL(wp), DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_2d   !< 
     6696    REAL(wp), DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_2d   !<
    66986697
    66996698    REAL(wp), DIMENSION(nzb_soil:nzt_soil,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !<
     
    67016700    TYPE(surf_type_lsm), SAVE :: tmp_walltype_h_1d   !< temporary 1D array containing the respective surface variable stored on file, horizontal surfaces
    67026701    TYPE(surf_type_lsm), SAVE :: tmp_walltype_h_2d   !< temporary 2D array containing the respective surface variable stored on file, horizontal surfaces
    6703     TYPE(surf_type_lsm), SAVE :: tmp_walltype_h_2d2  !< temporary 2D array containing the respective surface variable stored on file, horizontal surfaces 
    6704 
    6705     TYPE(surf_type_lsm), DIMENSION(0:3), SAVE :: tmp_walltype_v_1d   !< temporary 1D array containing the respective surface variable stored on file, vertical surfaces 
    6706     TYPE(surf_type_lsm), DIMENSION(0:3), SAVE :: tmp_walltype_v_2d   !< temporary 2D array containing the respective surface variable stored on file, vertical surfaces 
     6702    TYPE(surf_type_lsm), SAVE :: tmp_walltype_h_2d2  !< temporary 2D array containing the respective surface variable stored on file, horizontal surfaces
     6703
     6704    TYPE(surf_type_lsm), DIMENSION(0:3), SAVE :: tmp_walltype_v_1d   !< temporary 1D array containing the respective surface variable stored on file, vertical surfaces
     6705    TYPE(surf_type_lsm), DIMENSION(0:3), SAVE :: tmp_walltype_v_2d   !< temporary 2D array containing the respective surface variable stored on file, vertical surfaces
    67076706    TYPE(surf_type_lsm), DIMENSION(0:3), SAVE :: tmp_walltype_v_2d2  !< temporary 2D array containing the respective surface variable stored on file, vertical surfaces
    67086707
     
    67146713
    67156714       CASE ( 'ns_h_on_file_lsm' )
    6716           IF ( k == 1 )  THEN 
     6715          IF ( k == 1 )  THEN
    67176716             READ ( 13 ) ns_h_on_file_lsm
    67186717
    67196718             IF ( ALLOCATED( tmp_walltype_h_1d%var_1d ) )                      &
    6720                 DEALLOCATE( tmp_walltype_h_1d%var_1d )                         
     6719                DEALLOCATE( tmp_walltype_h_1d%var_1d )
    67216720             IF ( ALLOCATED( tmp_walltype_h_2d%var_2d ) )                      &
    6722                 DEALLOCATE( tmp_walltype_h_2d%var_2d )                         
     6721                DEALLOCATE( tmp_walltype_h_2d%var_2d )
    67236722             IF ( ALLOCATED( tmp_walltype_h_2d2%var_2d ) )                     &
    6724                 DEALLOCATE( tmp_walltype_h_2d2%var_2d )                       
    6725                                                                                
    6726 !                                                                             
    6727 !--          Allocate temporary arrays to store surface data                   
    6728              ALLOCATE( tmp_walltype_h_1d%var_1d(1:ns_h_on_file_lsm) )         
     6723                DEALLOCATE( tmp_walltype_h_2d2%var_2d )
     6724
     6725!
     6726!--          Allocate temporary arrays to store surface data
     6727             ALLOCATE( tmp_walltype_h_1d%var_1d(1:ns_h_on_file_lsm) )
    67296728             ALLOCATE( tmp_walltype_h_2d%var_2d(nzb_soil:nzt_soil+1,           &
    6730                                                 1:ns_h_on_file_lsm) )         
     6729                                                1:ns_h_on_file_lsm) )
    67316730             ALLOCATE( tmp_walltype_h_2d2%var_2d(nzb_soil:nzt_soil,            &
    6732                        1:ns_h_on_file_lsm)  )                                 
    6733                                                                                
    6734           ENDIF                                                               
    6735                                                                                
    6736        CASE ( 'ns_v_on_file_lsm' )                                             
    6737           IF ( k == 1 )  THEN                                                 
    6738              READ ( 13 ) ns_v_on_file_lsm                                     
    6739                                                                                
    6740              DO  l = 0, 3                                                     
     6731                       1:ns_h_on_file_lsm)  )
     6732
     6733          ENDIF
     6734
     6735       CASE ( 'ns_v_on_file_lsm' )
     6736          IF ( k == 1 )  THEN
     6737             READ ( 13 ) ns_v_on_file_lsm
     6738
     6739             DO  l = 0, 3
    67416740                IF ( ALLOCATED( tmp_walltype_v_1d(l)%var_1d ) )                &
    6742                    DEALLOCATE( tmp_walltype_v_1d(l)%var_1d )                   
     6741                   DEALLOCATE( tmp_walltype_v_1d(l)%var_1d )
    67436742                IF ( ALLOCATED( tmp_walltype_v_2d(l)%var_2d ) )                &
    6744                    DEALLOCATE( tmp_walltype_v_2d(l)%var_2d )                   
     6743                   DEALLOCATE( tmp_walltype_v_2d(l)%var_2d )
    67456744                IF ( ALLOCATED( tmp_walltype_v_2d2(l)%var_2d ) )               &
    6746                    DEALLOCATE( tmp_walltype_v_2d2(l)%var_2d )                 
    6747              ENDDO                                                             
    6748                                                                                
    6749 !                                                                             
    6750 !--          Allocate temporary arrays to store surface data                   
    6751              DO  l = 0, 3                                                     
     6745                   DEALLOCATE( tmp_walltype_v_2d2(l)%var_2d )
     6746             ENDDO
     6747
     6748!
     6749!--          Allocate temporary arrays to store surface data
     6750             DO  l = 0, 3
    67526751                ALLOCATE( tmp_walltype_v_1d(l)                                 &
    6753                              %var_1d(1:ns_v_on_file_lsm(l)) )                 
     6752                             %var_1d(1:ns_v_on_file_lsm(l)) )
    67546753                ALLOCATE( tmp_walltype_v_2d(l)                                 &
    67556754                             %var_2d(nzb_soil:nzt_soil+1,                      &
    6756                                      1:ns_v_on_file_lsm(l)) )                 
     6755                                     1:ns_v_on_file_lsm(l)) )
    67576756                ALLOCATE( tmp_walltype_v_2d2(l)                                &
    67586757                             %var_2d(nzb_soil:nzt_soil,                        &
    6759                                      1:ns_v_on_file_lsm(l))  )                 
    6760              ENDDO                                                             
    6761                                                                                
    6762           ENDIF                                                               
    6763                                                                                
    6764                                                                                
    6765        CASE ( 'c_liq_av' )                                                     
    6766           IF ( .NOT. ALLOCATED( c_liq_av ) )  THEN                             
    6767              ALLOCATE( c_liq_av(nysg:nyng,nxlg:nxrg) )                         
    6768           ENDIF                                                               
    6769           IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
     6758                                     1:ns_v_on_file_lsm(l))  )
     6759             ENDDO
     6760
     6761          ENDIF
     6762
     6763
     6764       CASE ( 'c_liq_av' )
     6765          IF ( .NOT. ALLOCATED( c_liq_av ) )  THEN
     6766             ALLOCATE( c_liq_av(nysg:nyng,nxlg:nxrg) )
     6767          ENDIF
     6768          IF ( k == 1 )  READ ( 13 )  tmp_2d
    67706769          c_liq_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                  &
    6771              tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
    6772                                                                                
    6773        CASE ( 'c_soil_av' )                                                   
    6774           IF ( .NOT. ALLOCATED( c_soil_av ) )  THEN                           
    6775              ALLOCATE( c_soil_av(nysg:nyng,nxlg:nxrg) )                       
    6776           ENDIF                                                               
    6777           IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
     6770             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
     6771
     6772       CASE ( 'c_soil_av' )
     6773          IF ( .NOT. ALLOCATED( c_soil_av ) )  THEN
     6774             ALLOCATE( c_soil_av(nysg:nyng,nxlg:nxrg) )
     6775          ENDIF
     6776          IF ( k == 1 )  READ ( 13 )  tmp_2d
    67786777          c_soil_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                 &
    6779              tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
    6780                                                                                
    6781        CASE ( 'c_veg_av' )                                                     
    6782           IF ( .NOT. ALLOCATED( c_veg_av ) )  THEN                             
    6783              ALLOCATE( c_veg_av(nysg:nyng,nxlg:nxrg) )                         
    6784           ENDIF                                                               
    6785           IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
     6778             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
     6779
     6780       CASE ( 'c_veg_av' )
     6781          IF ( .NOT. ALLOCATED( c_veg_av ) )  THEN
     6782             ALLOCATE( c_veg_av(nysg:nyng,nxlg:nxrg) )
     6783          ENDIF
     6784          IF ( k == 1 )  READ ( 13 )  tmp_2d
    67866785          c_veg_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                  &
    6787              tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
    6788                                                                                
    6789        CASE ( 'lai_av' )                                                       
    6790           IF ( .NOT. ALLOCATED( lai_av ) )  THEN                               
    6791              ALLOCATE( lai_av(nysg:nyng,nxlg:nxrg) )                           
    6792           ENDIF                                                               
    6793           IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
     6786             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
     6787
     6788       CASE ( 'lai_av' )
     6789          IF ( .NOT. ALLOCATED( lai_av ) )  THEN
     6790             ALLOCATE( lai_av(nysg:nyng,nxlg:nxrg) )
     6791          ENDIF
     6792          IF ( k == 1 )  READ ( 13 )  tmp_2d
    67946793          lai_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                    &
    6795              tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
    6796                                                                                
    6797        CASE ( 'm_liq_av' )                                                     
    6798           IF ( .NOT. ALLOCATED( m_liq_av ) )  THEN                             
    6799              ALLOCATE( m_liq_av(nysg:nyng,nxlg:nxrg) )                         
    6800           ENDIF                                                               
    6801           IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
     6794             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
     6795
     6796       CASE ( 'm_liq_av' )
     6797          IF ( .NOT. ALLOCATED( m_liq_av ) )  THEN
     6798             ALLOCATE( m_liq_av(nysg:nyng,nxlg:nxrg) )
     6799          ENDIF
     6800          IF ( k == 1 )  READ ( 13 )  tmp_2d
    68026801          m_liq_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                  &
    6803              tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
    6804                                                                                
    6805        CASE ( 'm_soil_av' )                                                   
    6806           IF ( .NOT. ALLOCATED( m_soil_av ) )  THEN                           
    6807              ALLOCATE( m_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )     
    6808           ENDIF                                                               
    6809           IF ( k == 1 )  READ ( 13 )  tmp_3d(:,:,:)                           
     6802             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
     6803
     6804       CASE ( 'm_soil_av' )
     6805          IF ( .NOT. ALLOCATED( m_soil_av ) )  THEN
     6806             ALLOCATE( m_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )
     6807          ENDIF
     6808          IF ( k == 1 )  READ ( 13 )  tmp_3d(:,:,:)
    68106809          m_soil_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =               &
    68116810             tmp_3d(nzb_soil:nzt_soil,nysf                                     &
    6812                     -nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                       
    6813                                                                                
    6814        CASE ( 'qsws_liq_av' )                                                 
    6815           IF ( .NOT. ALLOCATED( qsws_liq_av ) )  THEN                         
    6816              ALLOCATE( qsws_liq_av(nysg:nyng,nxlg:nxrg) )                     
    6817           ENDIF                                                               
    6818           IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
     6811                    -nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
     6812
     6813       CASE ( 'qsws_liq_av' )
     6814          IF ( .NOT. ALLOCATED( qsws_liq_av ) )  THEN
     6815             ALLOCATE( qsws_liq_av(nysg:nyng,nxlg:nxrg) )
     6816          ENDIF
     6817          IF ( k == 1 )  READ ( 13 )  tmp_2d
    68196818          qsws_liq_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =              &
    6820              tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
    6821        CASE ( 'qsws_soil_av' )                                                 
    6822           IF ( .NOT. ALLOCATED( qsws_soil_av ) )  THEN                         
    6823              ALLOCATE( qsws_soil_av(nysg:nyng,nxlg:nxrg) )                     
    6824           ENDIF                                                               
    6825           IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
     6819             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
     6820       CASE ( 'qsws_soil_av' )
     6821          IF ( .NOT. ALLOCATED( qsws_soil_av ) )  THEN
     6822             ALLOCATE( qsws_soil_av(nysg:nyng,nxlg:nxrg) )
     6823          ENDIF
     6824          IF ( k == 1 )  READ ( 13 )  tmp_2d
    68266825          qsws_soil_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =             &
    6827              tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
    6828                                                                                
    6829        CASE ( 'qsws_veg_av' )                                                 
    6830           IF ( .NOT. ALLOCATED( qsws_veg_av ) )  THEN                         
    6831              ALLOCATE( qsws_veg_av(nysg:nyng,nxlg:nxrg) )                     
    6832           ENDIF                                                               
    6833           IF ( k == 1 )  READ ( 13 )  tmp_2d                                   
     6826             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
     6827
     6828       CASE ( 'qsws_veg_av' )
     6829          IF ( .NOT. ALLOCATED( qsws_veg_av ) )  THEN
     6830             ALLOCATE( qsws_veg_av(nysg:nyng,nxlg:nxrg) )
     6831          ENDIF
     6832          IF ( k == 1 )  READ ( 13 )  tmp_2d
    68346833          qsws_veg_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =              &
    6835              tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                   
    6836                                                                                
    6837        CASE ( 't_soil_av' )                                                   
    6838           IF ( .NOT. ALLOCATED( t_soil_av ) )  THEN                           
    6839              ALLOCATE( t_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )     
    6840           ENDIF                                                               
    6841           IF ( k == 1 )  READ ( 13 )  tmp_3d(:,:,:)                           
     6834             tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
     6835
     6836       CASE ( 't_soil_av' )
     6837          IF ( .NOT. ALLOCATED( t_soil_av ) )  THEN
     6838             ALLOCATE( t_soil_av(nzb_soil:nzt_soil,nysg:nyng,nxlg:nxrg) )
     6839          ENDIF
     6840          IF ( k == 1 )  READ ( 13 )  tmp_3d(:,:,:)
    68426841          t_soil_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =               &
    6843              tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)                 
    6844                                                                                
    6845        CASE ( 'lsm_start_index_h', 'lsm_start_index_v'  )                     
    6846             IF ( k == 1 )  THEN                                               
    6847                                                                                
     6842             tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
     6843
     6844       CASE ( 'lsm_start_index_h', 'lsm_start_index_v'  )
     6845            IF ( k == 1 )  THEN
     6846
    68486847               IF ( ALLOCATED( start_index_on_file ) )                         &
    6849                   DEALLOCATE( start_index_on_file )                           
    6850                                                                                
     6848                  DEALLOCATE( start_index_on_file )
     6849
    68516850               ALLOCATE ( start_index_on_file(nys_on_file:nyn_on_file,         &
    6852                nxl_on_file:nxr_on_file) )                                     
    6853                                                                                
    6854                READ ( 13 )  start_index_on_file                               
    6855                                                                                
    6856             ENDIF                                                             
    6857                                                                                
    6858        CASE ( 'lsm_end_index_h', 'lsm_end_index_v' )                           
    6859             IF ( k == 1 )  THEN                                               
    6860                                                                                
     6851               nxl_on_file:nxr_on_file) )
     6852
     6853               READ ( 13 )  start_index_on_file
     6854
     6855            ENDIF
     6856
     6857       CASE ( 'lsm_end_index_h', 'lsm_end_index_v' )
     6858            IF ( k == 1 )  THEN
     6859
    68616860               IF ( ALLOCATED( end_index_on_file ) )                           &
    6862                   DEALLOCATE( end_index_on_file )                             
    6863                                                                                
     6861                  DEALLOCATE( end_index_on_file )
     6862
    68646863               ALLOCATE ( end_index_on_file(nys_on_file:nyn_on_file,           &
    6865                   nxl_on_file:nxr_on_file) )                                   
    6866                                                                                
    6867                READ ( 13 )  end_index_on_file                                 
    6868                                                                                
    6869             ENDIF                                                             
    6870                                                                                
    6871        CASE ( 't_soil_h' )                                                     
    6872                                                                                
    6873           IF ( k == 1 )  THEN                                                 
     6864                  nxl_on_file:nxr_on_file) )
     6865
     6866               READ ( 13 )  end_index_on_file
     6867
     6868            ENDIF
     6869
     6870       CASE ( 't_soil_h' )
     6871
     6872          IF ( k == 1 )  THEN
    68746873             IF ( .NOT.  ALLOCATED( t_soil_h%var_2d ) )                        &
    68756874                ALLOCATE( t_soil_h%var_2d(nzb_soil:nzt_soil+1,                 &
    6876                                           1:surf_lsm_h%ns) )                   
    6877              READ ( 13 )  tmp_walltype_h_2d%var_2d                             
    6878           ENDIF                                                               
     6875                                          1:surf_lsm_h%ns) )
     6876             READ ( 13 )  tmp_walltype_h_2d%var_2d
     6877          ENDIF
    68796878          CALL surface_restore_elements(                                       &
    68806879                                     t_soil_h%var_2d,                          &
    68816880                                     tmp_walltype_h_2d%var_2d,                 &
    6882                                      surf_lsm_h%start_index,                   & 
     6881                                     surf_lsm_h%start_index,                   &
    68836882                                     start_index_on_file,                      &
    68846883                                     end_index_on_file,                        &
     
    68866885                                     nxlf, nxrf, nysf, nynf,                   &
    68876886                                     nys_on_file, nyn_on_file,                 &
    6888                                      nxl_on_file,nxr_on_file )                 
    6889                                                                                
    6890        CASE ( 't_soil_v(0)' )                                                 
    6891                                                                                
    6892           IF ( k == 1 )  THEN                                                 
     6887                                     nxl_on_file,nxr_on_file )
     6888
     6889       CASE ( 't_soil_v(0)' )
     6890
     6891          IF ( k == 1 )  THEN
    68936892             IF ( .NOT.  ALLOCATED( t_soil_v(0)%var_2d ) )                     &
    68946893                ALLOCATE( t_soil_v(0)%var_2d(nzb_soil:nzt_soil+1,              &
    6895                                              1:surf_lsm_v(0)%ns) )             
    6896              READ ( 13 )  tmp_walltype_v_2d(0)%var_2d                         
    6897           ENDIF                                                               
     6894                                             1:surf_lsm_v(0)%ns) )
     6895             READ ( 13 )  tmp_walltype_v_2d(0)%var_2d
     6896          ENDIF
    68986897          CALL surface_restore_elements(                                       &
    68996898                                  t_soil_v(0)%var_2d,                          &
    69006899                                  tmp_walltype_v_2d(0)%var_2d,                 &
    6901                                   surf_lsm_v(0)%start_index,                   & 
     6900                                  surf_lsm_v(0)%start_index,                   &
    69026901                                  start_index_on_file,                         &
    69036902                                  end_index_on_file,                           &
     
    69056904                                  nxlf, nxrf, nysf, nynf,                      &
    69066905                                  nys_on_file, nyn_on_file,                    &
    6907                                   nxl_on_file,nxr_on_file )                   
    6908                                                                                
    6909        CASE ( 't_soil_v(1)' )                                                 
    6910                                                                                
    6911           IF ( k == 1 )  THEN                                                 
     6906                                  nxl_on_file,nxr_on_file )
     6907
     6908       CASE ( 't_soil_v(1)' )
     6909
     6910          IF ( k == 1 )  THEN
    69126911             IF ( .NOT.  ALLOCATED( t_soil_v(1)%var_2d ) )                     &
    69136912                ALLOCATE( t_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,              &
    6914                                              1:surf_lsm_v(1)%ns) )             
    6915              READ ( 13 )  tmp_walltype_v_2d(1)%var_2d                         
    6916           ENDIF                                                               
     6913                                             1:surf_lsm_v(1)%ns) )
     6914             READ ( 13 )  tmp_walltype_v_2d(1)%var_2d
     6915          ENDIF
    69176916          CALL surface_restore_elements(                                       &
    69186917                                  t_soil_v(1)%var_2d,                          &
    69196918                                  tmp_walltype_v_2d(1)%var_2d,                 &
    6920                                   surf_lsm_v(1)%start_index,                   &   
     6919                                  surf_lsm_v(1)%start_index,                   &
    69216920                                  start_index_on_file,                         &
    69226921                                  end_index_on_file,                           &
     
    69246923                                  nxlf, nxrf, nysf, nynf,                      &
    69256924                                  nys_on_file, nyn_on_file,                    &
    6926                                   nxl_on_file,nxr_on_file )                   
    6927                                                                                
    6928        CASE ( 't_soil_v(2)' )                                                 
    6929                                                                                
    6930           IF ( k == 1 )  THEN                                                 
     6925                                  nxl_on_file,nxr_on_file )
     6926
     6927       CASE ( 't_soil_v(2)' )
     6928
     6929          IF ( k == 1 )  THEN
    69316930             IF ( .NOT.  ALLOCATED( t_soil_v(2)%var_2d ) )                     &
    69326931                ALLOCATE( t_soil_v(2)%var_2d(nzb_soil:nzt_soil+1,              &
    6933                                              1:surf_lsm_v(2)%ns) )             
    6934              READ ( 13 )  tmp_walltype_v_2d(2)%var_2d                         
    6935           ENDIF                                                               
     6932                                             1:surf_lsm_v(2)%ns) )
     6933             READ ( 13 )  tmp_walltype_v_2d(2)%var_2d
     6934          ENDIF
    69366935          CALL surface_restore_elements(                                       &
    69376936                                  t_soil_v(2)%var_2d,                          &
    69386937                                  tmp_walltype_v_2d(2)%var_2d,                 &
    6939                                   surf_lsm_v(2)%start_index,                   & 
     6938                                  surf_lsm_v(2)%start_index,                   &
    69406939                                  start_index_on_file,                         &
    69416940                                  end_index_on_file,                           &
     
    69436942                                  nxlf, nxrf, nysf, nynf,                      &
    69446943                                  nys_on_file, nyn_on_file,                    &
    6945                                   nxl_on_file,nxr_on_file )                   
    6946                                                                                
    6947        CASE ( 't_soil_v(3)' )                                                 
    6948                                                                                
    6949           IF ( k == 1 )  THEN                                                 
     6944                                  nxl_on_file,nxr_on_file )
     6945
     6946       CASE ( 't_soil_v(3)' )
     6947
     6948          IF ( k == 1 )  THEN
    69506949             IF ( .NOT.  ALLOCATED( t_soil_v(3)%var_2d ) )                     &
    69516950                ALLOCATE( t_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,              &
    6952                                              1:surf_lsm_v(3)%ns) )             
    6953              READ ( 13 )  tmp_walltype_v_2d(3)%var_2d                         
    6954           ENDIF                                                               
     6951                                             1:surf_lsm_v(3)%ns) )
     6952             READ ( 13 )  tmp_walltype_v_2d(3)%var_2d
     6953          ENDIF
    69556954          CALL surface_restore_elements(                                       &
    69566955                                  t_soil_v(3)%var_2d,                          &
    69576956                                  tmp_walltype_v_2d(3)%var_2d,                 &
    6958                                   surf_lsm_v(3)%start_index,                   & 
     6957                                  surf_lsm_v(3)%start_index,                   &
    69596958                                  start_index_on_file,                         &
    69606959                                  end_index_on_file,                           &
     
    69626961                                  nxlf, nxrf, nysf, nynf,                      &
    69636962                                  nys_on_file, nyn_on_file,                    &
    6964                                   nxl_on_file,nxr_on_file )                   
    6965                                                                                
    6966        CASE ( 'm_soil_h' )                                                     
    6967                                                                                
    6968           IF ( k == 1 )  THEN                                                 
     6963                                  nxl_on_file,nxr_on_file )
     6964
     6965       CASE ( 'm_soil_h' )
     6966
     6967          IF ( k == 1 )  THEN
    69696968             IF ( .NOT.  ALLOCATED( m_soil_h%var_2d ) )                        &
    69706969                ALLOCATE( m_soil_h%var_2d(nzb_soil:nzt_soil+1,                 &
    6971                                           1:surf_lsm_h%ns) )                   
    6972              READ ( 13 )  tmp_walltype_h_2d2%var_2d                           
    6973           ENDIF                                                               
     6970                                          1:surf_lsm_h%ns) )
     6971             READ ( 13 )  tmp_walltype_h_2d2%var_2d
     6972          ENDIF
    69746973          CALL surface_restore_elements(                                       &
    69756974                                    m_soil_h%var_2d,                           &
    69766975                                    tmp_walltype_h_2d2%var_2d,                 &
    6977                                     surf_lsm_h%start_index,                    & 
     6976                                    surf_lsm_h%start_index,                    &
    69786977                                    start_index_on_file,                       &
    69796978                                    end_index_on_file,                         &
     
    69816980                                    nxlf, nxrf, nysf, nynf,                    &
    69826981                                    nys_on_file, nyn_on_file,                  &
    6983                                     nxl_on_file,nxr_on_file )                 
    6984                                                                                
    6985        CASE ( 'm_soil_v(0)' )                                                 
    6986                                                                                
    6987           IF ( k == 1 )  THEN                                                 
     6982                                    nxl_on_file,nxr_on_file )
     6983
     6984       CASE ( 'm_soil_v(0)' )
     6985
     6986          IF ( k == 1 )  THEN
    69886987             IF ( .NOT.  ALLOCATED( m_soil_v(0)%var_2d ) )                     &
    69896988                ALLOCATE( m_soil_v(0)%var_2d(nzb_soil:nzt_soil+1,              &
    6990                                              1:surf_lsm_v(0)%ns) )             
    6991              READ ( 13 )  tmp_walltype_v_2d2(0)%var_2d                         
    6992           ENDIF                                                               
     6989                                             1:surf_lsm_v(0)%ns) )
     6990             READ ( 13 )  tmp_walltype_v_2d2(0)%var_2d
     6991          ENDIF
    69936992          CALL surface_restore_elements(                                       &
    6994                                  m_soil_v(0)%var_2d,                           & 
     6993                                 m_soil_v(0)%var_2d,                           &
    69956994                                 tmp_walltype_v_2d2(0)%var_2d,                 &
    6996                                  surf_lsm_v(0)%start_index,                    & 
     6995                                 surf_lsm_v(0)%start_index,                    &
    69976996                                 start_index_on_file,                          &
    69986997                                 end_index_on_file,                            &
     
    70006999                                 nxlf, nxrf, nysf, nynf,                       &
    70017000                                 nys_on_file, nyn_on_file,                     &
    7002                                  nxl_on_file,nxr_on_file )                     
    7003                                                                                
    7004        CASE ( 'm_soil_v(1)' )                                                 
    7005                                                                                
    7006           IF ( k == 1 )  THEN                                                 
     7001                                 nxl_on_file,nxr_on_file )
     7002
     7003       CASE ( 'm_soil_v(1)' )
     7004
     7005          IF ( k == 1 )  THEN
    70077006             IF ( .NOT.  ALLOCATED( m_soil_v(1)%var_2d ) )                     &
    70087007                ALLOCATE( m_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,              &
    7009                                              1:surf_lsm_v(1)%ns) )             
    7010              READ ( 13 )  tmp_walltype_v_2d2(1)%var_2d                         
    7011           ENDIF                                                               
     7008                                             1:surf_lsm_v(1)%ns) )
     7009             READ ( 13 )  tmp_walltype_v_2d2(1)%var_2d
     7010          ENDIF
    70127011          CALL surface_restore_elements(                                       &
    7013                                  m_soil_v(1)%var_2d,                           &   
     7012                                 m_soil_v(1)%var_2d,                           &
    70147013                                 tmp_walltype_v_2d2(1)%var_2d,                 &
    7015                                  surf_lsm_v(1)%start_index,                    & 
     7014                                 surf_lsm_v(1)%start_index,                    &
    70167015                                 start_index_on_file,                          &
    70177016                                 end_index_on_file,                            &
     
    70197018                                 nxlf, nxrf, nysf, nynf,                       &
    70207019                                 nys_on_file, nyn_on_file,                     &
    7021                                  nxl_on_file,nxr_on_file )                     
    7022                                                                                
    7023                                                                                
    7024        CASE ( 'm_soil_v(2)' )                                                 
    7025                                                                                
    7026           IF ( k == 1 )  THEN                                                 
     7020                                 nxl_on_file,nxr_on_file )
     7021
     7022
     7023       CASE ( 'm_soil_v(2)' )
     7024
     7025          IF ( k == 1 )  THEN
    70277026             IF ( .NOT.  ALLOCATED( m_soil_v(2)%var_2d ) )                     &
    70287027                ALLOCATE( m_soil_v(2)%var_2d(nzb_soil:nzt_soil+1,              &
    7029                                              1:surf_lsm_v(2)%ns) )             
    7030              READ ( 13 )  tmp_walltype_v_2d2(2)%var_2d                         
    7031           ENDIF                                                               
     7028                                             1:surf_lsm_v(2)%ns) )
     7029             READ ( 13 )  tmp_walltype_v_2d2(2)%var_2d
     7030          ENDIF
    70327031          CALL surface_restore_elements(                                       &
    7033                                  m_soil_v(2)%var_2d,                           & 
     7032                                 m_soil_v(2)%var_2d,                           &
    70347033                                 tmp_walltype_v_2d2(2)%var_2d,                 &
    7035                                  surf_lsm_v(2)%start_index,                    &   
     7034                                 surf_lsm_v(2)%start_index,                    &
    70367035                                 start_index_on_file,                          &
    70377036                                 end_index_on_file,                            &
     
    70397038                                 nxlf, nxrf, nysf, nynf,                       &
    70407039                                 nys_on_file, nyn_on_file,                     &
    7041                                  nxl_on_file,nxr_on_file )                     
    7042                                                                                
    7043                                                                                
    7044        CASE ( 'm_soil_v(3)' )                                                 
    7045                                                                                
    7046           IF ( k == 1 )  THEN                                                 
     7040                                 nxl_on_file,nxr_on_file )
     7041
     7042
     7043       CASE ( 'm_soil_v(3)' )
     7044
     7045          IF ( k == 1 )  THEN
    70477046             IF ( .NOT.  ALLOCATED( m_soil_v(3)%var_2d ) )                     &
    70487047                ALLOCATE( m_soil_v(1)%var_2d(nzb_soil:nzt_soil+1,              &
    7049                                              1:surf_lsm_v(3)%ns) )             
    7050              READ ( 13 )  tmp_walltype_v_2d2(3)%var_2d                         
    7051           ENDIF                                                               
     7048                                             1:surf_lsm_v(3)%ns) )
     7049             READ ( 13 )  tmp_walltype_v_2d2(3)%var_2d
     7050          ENDIF
    70527051          CALL surface_restore_elements(                                       &
    7053                                  m_soil_v(3)%var_2d,                           & 
     7052                                 m_soil_v(3)%var_2d,                           &
    70547053                                 tmp_walltype_v_2d2(3)%var_2d,                 &
    7055                                  surf_lsm_v(3)%start_index,                    & 
     7054                                 surf_lsm_v(3)%start_index,                    &
    70567055                                 start_index_on_file,                          &
    70577056                                 end_index_on_file,                            &
     
    70597058                                 nxlf, nxrf, nysf, nynf,                       &
    70607059                                 nys_on_file, nyn_on_file,                     &
    7061                                  nxl_on_file,nxr_on_file )                     
    7062                                                                                
    7063                                                                                
    7064        CASE ( 'm_liq_h' )                                                     
    7065                                                                                
    7066           IF ( k == 1 )  THEN                                                 
     7060                                 nxl_on_file,nxr_on_file )
     7061
     7062
     7063       CASE ( 'm_liq_h' )
     7064
     7065          IF ( k == 1 )  THEN
    70677066             IF ( .NOT.  ALLOCATED( m_liq_h%var_1d ) )                         &
    7068                 ALLOCATE( m_liq_h%var_1d(1:surf_lsm_h%ns) )                   
    7069              READ ( 13 )  tmp_walltype_h_1d%var_1d                             
    7070           ENDIF                                                               
     7067                ALLOCATE( m_liq_h%var_1d(1:surf_lsm_h%ns) )
     7068             READ ( 13 )  tmp_walltype_h_1d%var_1d
     7069          ENDIF
    70717070          CALL surface_restore_elements(                                       &
    70727071                                     m_liq_h%var_1d,                           &
    70737072                                     tmp_walltype_h_1d%var_1d,                 &
    7074                                      surf_lsm_h%start_index,                   & 
     7073                                     surf_lsm_h%start_index,                   &
    70757074                                     start_index_on_file,                      &
    70767075                                     end_index_on_file,                        &
     
    70787077                                     nxlf, nxrf, nysf, nynf,                   &
    70797078                                     nys_on_file, nyn_on_file,                 &
    7080                                      nxl_on_file,nxr_on_file )                 
    7081                                                                                
    7082                                                                                
    7083        CASE ( 'm_liq_v(0)' )                                                   
    7084                                                                                
    7085           IF ( k == 1 )  THEN                                                 
     7079                                     nxl_on_file,nxr_on_file )
     7080
     7081
     7082       CASE ( 'm_liq_v(0)' )
     7083
     7084          IF ( k == 1 )  THEN
    70867085             IF ( .NOT.  ALLOCATED( m_liq_v(0)%var_1d ) )                      &
    7087                 ALLOCATE( m_liq_v(0)%var_1d(1:surf_lsm_v(0)%ns) )             
    7088              READ ( 13 )  tmp_walltype_v_1d(0)%var_1d                         
    7089           ENDIF                                                               
     7086                ALLOCATE( m_liq_v(0)%var_1d(1:surf_lsm_v(0)%ns) )
     7087             READ ( 13 )  tmp_walltype_v_1d(0)%var_1d
     7088          ENDIF
    70907089          CALL surface_restore_elements(                                       &
    70917090                                  m_liq_v(0)%var_1d,                           &
    70927091                                  tmp_walltype_v_1d(0)%var_1d,                 &
    7093                                   surf_lsm_v(0)%start_index,                   & 
     7092                                  surf_lsm_v(0)%start_index,                   &
    70947093                                  start_index_on_file,                         &
    70957094                                  end_index_on_file,                           &
     
    70977096                                  nxlf, nxrf, nysf, nynf,                      &
    70987097                                  nys_on_file, nyn_on_file,                    &
    7099                                   nxl_on_file,nxr_on_file )                   
    7100                                                                                
    7101                                                                                
    7102        CASE ( 'm_liq_v(1)' )                                                   
    7103                                                                                
    7104           IF ( k == 1 )  THEN                                                 
     7098                                  nxl_on_file,nxr_on_file )
     7099
     7100
     7101       CASE ( 'm_liq_v(1)' )
     7102
     7103          IF ( k == 1 )  THEN
    71057104             IF ( .NOT.  ALLOCATED( m_liq_v(1)%var_1d ) )                      &
    7106                 ALLOCATE( m_liq_v(1)%var_1d(1:surf_lsm_v(1)%ns) )             
    7107              READ ( 13 )  tmp_walltype_v_1d(1)%var_1d                         
    7108           ENDIF                                                               
     7105                ALLOCATE( m_liq_v(1)%var_1d(1:surf_lsm_v(1)%ns) )
     7106             READ ( 13 )  tmp_walltype_v_1d(1)%var_1d
     7107          ENDIF
    71097108          CALL surface_restore_elements(                                       &
    71107109                                  m_liq_v(1)%var_1d,                           &
    71117110                                  tmp_walltype_v_1d(1)%var_1d,                 &
    7112                                   surf_lsm_v(1)%start_index,                   & 
     7111                                  surf_lsm_v(1)%start_index,                   &
    71137112                                  start_index_on_file,                         &
    71147113                                  end_index_on_file,                           &
     
    71167115                                  nxlf, nxrf, nysf, nynf,                      &
    71177116                                  nys_on_file, nyn_on_file,                    &
    7118                                   nxl_on_file,nxr_on_file )                   
    7119                                                                                
    7120                                                                                
    7121        CASE ( 'm_liq_v(2)' )                                                   
    7122                                                                                
    7123           IF ( k == 1 )  THEN                                                 
     7117                                  nxl_on_file,nxr_on_file )
     7118
     7119
     7120       CASE ( 'm_liq_v(2)' )
     7121
     7122          IF ( k == 1 )  THEN
    71247123             IF ( .NOT.  ALLOCATED( m_liq_v(2)%var_1d ) )                      &
    7125                 ALLOCATE( m_liq_v(2)%var_1d(1:surf_lsm_v(2)%ns) )             
    7126              READ ( 13 )  tmp_walltype_v_1d(2)%var_1d                         
    7127           ENDIF                                                               
     7124                ALLOCATE( m_liq_v(2)%var_1d(1:surf_lsm_v(2)%ns) )
     7125             READ ( 13 )  tmp_walltype_v_1d(2)%var_1d
     7126          ENDIF
    71287127          CALL surface_restore_elements(                                       &
    71297128                                  m_liq_v(2)%var_1d,                           &
    71307129                                  tmp_walltype_v_1d(2)%var_1d,                 &
    7131                                   surf_lsm_v(2)%start_index,                   & 
     7130                                  surf_lsm_v(2)%start_index,                   &
    71327131                                  start_index_on_file,                         &
    71337132                                  end_index_on_file,                           &
     
    71357134                                  nxlf, nxrf, nysf, nynf,                      &
    71367135                                  nys_on_file, nyn_on_file,                    &
    7137                                   nxl_on_file,nxr_on_file )                   
    7138                                                                                
    7139        CASE ( 'm_liq_v(3)' )                                                   
    7140                                                                                
    7141           IF ( k == 1 )  THEN                                                 
     7136                                  nxl_on_file,nxr_on_file )
     7137
     7138       CASE ( 'm_liq_v(3)' )
     7139
     7140          IF ( k == 1 )  THEN
    71427141             IF ( .NOT.  ALLOCATED( m_liq_v(3)%var_1d ) )                      &
    7143                 ALLOCATE( m_liq_v(3)%var_1d(1:surf_lsm_v(3)%ns) )             
    7144              READ ( 13 )  tmp_walltype_v_1d(3)%var_1d                         
    7145           ENDIF                                                               
     7142                ALLOCATE( m_liq_v(3)%var_1d(1:surf_lsm_v(3)%ns) )
     7143             READ ( 13 )  tmp_walltype_v_1d(3)%var_1d
     7144          ENDIF
    71467145          CALL surface_restore_elements(                                       &
    71477146                                  m_liq_v(3)%var_1d,                           &
    71487147                                  tmp_walltype_v_1d(3)%var_1d,                 &
    7149                                   surf_lsm_v(3)%start_index,                   & 
     7148                                  surf_lsm_v(3)%start_index,                   &
    71507149                                  start_index_on_file,                         &
    71517150                                  end_index_on_file,                           &
     
    71537152                                  nxlf, nxrf, nysf, nynf,                      &
    71547153                                  nys_on_file, nyn_on_file,                    &
    7155                                   nxl_on_file,nxr_on_file )                   
    7156                                                                                
    7157                                                                                
    7158        CASE ( 't_surface_h' )                                                 
    7159                                                                                
    7160           IF ( k == 1 )  THEN                                                 
     7154                                  nxl_on_file,nxr_on_file )
     7155
     7156
     7157       CASE ( 't_surface_h' )
     7158
     7159          IF ( k == 1 )  THEN
    71617160             IF ( .NOT.  ALLOCATED( t_surface_h%var_1d ) )                     &
    7162                 ALLOCATE( t_surface_h%var_1d(1:surf_lsm_h%ns) )               
    7163              READ ( 13 )  tmp_walltype_h_1d%var_1d                             
    7164           ENDIF                                                               
     7161                ALLOCATE( t_surface_h%var_1d(1:surf_lsm_h%ns) )
     7162             READ ( 13 )  tmp_walltype_h_1d%var_1d
     7163          ENDIF
    71657164          CALL surface_restore_elements(                                       &
    71667165                                     t_surface_h%var_1d,                       &
    71677166                                     tmp_walltype_h_1d%var_1d,                 &
    7168                                      surf_lsm_h%start_index,                   & 
     7167                                     surf_lsm_h%start_index,                   &
    71697168                                     start_index_on_file,                      &
    71707169                                     end_index_on_file,                        &
     
    71727171                                     nxlf, nxrf, nysf, nynf,                   &
    71737172                                     nys_on_file, nyn_on_file,                 &
    7174                                      nxl_on_file,nxr_on_file )                 
    7175                                                                                
    7176        CASE ( 't_surface_v(0)' )                                               
    7177                                                                                
    7178           IF ( k == 1 )  THEN                                                 
     7173                                     nxl_on_file,nxr_on_file )
     7174
     7175       CASE ( 't_surface_v(0)' )
     7176
     7177          IF ( k == 1 )  THEN
    71797178             IF ( .NOT.  ALLOCATED( t_surface_v(0)%var_1d ) )                  &
    7180                 ALLOCATE( t_surface_v(0)%var_1d(1:surf_lsm_v(0)%ns) )         
    7181              READ ( 13 )  tmp_walltype_v_1d(0)%var_1d                         
    7182           ENDIF                                                               
     7179                ALLOCATE( t_surface_v(0)%var_1d(1:surf_lsm_v(0)%ns) )
     7180             READ ( 13 )  tmp_walltype_v_1d(0)%var_1d
     7181          ENDIF
    71837182          CALL surface_restore_elements(                                       &
    71847183                                  t_surface_v(0)%var_1d,                       &
    71857184                                  tmp_walltype_v_1d(0)%var_1d,                 &
    7186                                   surf_lsm_v(0)%start_index,                   & 
     7185                                  surf_lsm_v(0)%start_index,                   &
    71877186                                  start_index_on_file,                         &
    71887187                                  end_index_on_file,                           &
     
    71907189                                  nxlf, nxrf, nysf, nynf,                      &
    71917190                                  nys_on_file, nyn_on_file,                    &
    7192                                   nxl_on_file,nxr_on_file )                   
    7193                                                                                
    7194        CASE ( 't_surface_v(1)' )                                               
    7195                                                                                
    7196           IF ( k == 1 )  THEN                                                 
     7191                                  nxl_on_file,nxr_on_file )
     7192
     7193       CASE ( 't_surface_v(1)' )
     7194
     7195          IF ( k == 1 )  THEN
    71977196             IF ( .NOT.  ALLOCATED( t_surface_v(1)%var_1d ) )                  &
    7198                 ALLOCATE( t_surface_v(1)%var_1d(1:surf_lsm_v(1)%ns) )         
    7199              READ ( 13 )  tmp_walltype_v_1d(1)%var_1d                         
    7200           ENDIF                                                               
     7197                ALLOCATE( t_surface_v(1)%var_1d(1:surf_lsm_v(1)%ns) )
     7198             READ ( 13 )  tmp_walltype_v_1d(1)%var_1d
     7199          ENDIF
    72017200          CALL surface_restore_elements(                                       &
    72027201                                  t_surface_v(1)%var_1d,                       &
    72037202                                  tmp_walltype_v_1d(1)%var_1d,                 &
    7204                                   surf_lsm_v(1)%start_index,                   &
    7205                                   start_index_on_file,                         &
    7206                                   end_index_on_file,                           &
    7207                                   nxlc, nysc,                                  &
    7208                                   nxlf, nxrf, nysf, nynf,                      &
    7209                                   nys_on_file, nyn_on_file,                    &
    7210                                   nxl_on_file,nxr_on_file )                   
    7211                                                                                
    7212        CASE ( 't_surface_v(2)' )                                               
    7213                                                                                
    7214           IF ( k == 1 )  THEN                                                 
    7215              IF ( .NOT.  ALLOCATED( t_surface_v(2)%var_1d ) )                  &
    7216                 ALLOCATE( t_surface_v(2)%var_1d(1:surf_lsm_v(2)%ns) )         
    7217              READ ( 13 )  tmp_walltype_v_1d(2)%var_1d                         
    7218           ENDIF                                                               
    7219           CALL surface_restore_elements(                                       &
    7220                                   t_surface_v(2)%var_1d,                       &
    7221                                   tmp_walltype_v_1d(2)%var_1d,                 &
    7222                                   surf_lsm_v(2)%start_index,                   &
     7203                                  surf_lsm_v(1)%start_index,                   &
    72237204                                  start_index_on_file,                         &
    72247205                                  end_index_on_file,                           &
     
    72267207                                  nxlf, nxrf, nysf, nynf,                      &
    72277208                                  nys_on_file, nyn_on_file,                    &
    7228                                   nxl_on_file,nxr_on_file )                   
    7229                                                                                
    7230        CASE ( 't_surface_v(3)' )                                               
    7231                                                                                
    7232           IF ( k == 1 )  THEN                                                 
     7209                                  nxl_on_file,nxr_on_file )
     7210
     7211       CASE ( 't_surface_v(2)' )
     7212
     7213          IF ( k == 1 )  THEN
     7214             IF ( .NOT.  ALLOCATED( t_surface_v(2)%var_1d ) )                  &
     7215                ALLOCATE( t_surface_v(2)%var_1d(1:surf_lsm_v(2)%ns) )
     7216             READ ( 13 )  tmp_walltype_v_1d(2)%var_1d
     7217          ENDIF
     7218          CALL surface_restore_elements(                                       &
     7219                                  t_surface_v(2)%var_1d,                       &
     7220                                  tmp_walltype_v_1d(2)%var_1d,                 &
     7221                                  surf_lsm_v(2)%start_index,                   &
     7222                                  start_index_on_file,                         &
     7223                                  end_index_on_file,                           &
     7224                                  nxlc, nysc,                                  &
     7225                                  nxlf, nxrf, nysf, nynf,                      &
     7226                                  nys_on_file, nyn_on_file,                    &
     7227                                  nxl_on_file,nxr_on_file )
     7228
     7229       CASE ( 't_surface_v(3)' )
     7230
     7231          IF ( k == 1 )  THEN
    72337232             IF ( .NOT.  ALLOCATED( t_surface_v(3)%var_1d ) )                  &
    7234                 ALLOCATE( t_surface_v(3)%var_1d(1:surf_lsm_v(3)%ns) )         
    7235              READ ( 13 )  tmp_walltype_v_1d(3)%var_1d                         
    7236           ENDIF                                                               
     7233                ALLOCATE( t_surface_v(3)%var_1d(1:surf_lsm_v(3)%ns) )
     7234             READ ( 13 )  tmp_walltype_v_1d(3)%var_1d
     7235          ENDIF
    72377236          CALL surface_restore_elements(                                       &
    72387237                                  t_surface_v(3)%var_1d,                       &
    72397238                                  tmp_walltype_v_1d(3)%var_1d,                 &
    7240                                   surf_lsm_v(3)%start_index,                   &   
     7239                                  surf_lsm_v(3)%start_index,                   &
    72417240                                  start_index_on_file,                         &
    72427241                                  end_index_on_file,                           &
     
    72727271       INTEGER(iwp) ::  j       !< running index
    72737272       INTEGER(iwp) ::  m       !< running index
    7274        
     7273
    72757274       LOGICAL      ::  flag_exceed_z0  = .FALSE. !< dummy flag to indicate whether roughness length is too high
    72767275       LOGICAL      ::  flag_exceed_z0h = .FALSE. !< dummy flag to indicate whether roughness length for scalars is too high
     
    72837282       DO  m = 1, surf_lsm_h%ns
    72847283
    7285           i   = surf_lsm_h%i(m)           
     7284          i   = surf_lsm_h%i(m)
    72867285          j   = surf_lsm_h%j(m)
    7287          
     7286
    72887287          IF ( surf_lsm_h%water_surface(m) )  THEN
    72897288
    72907289!
    7291 !--          Disabled: FLake parameterization. Ideally, the Charnock 
     7290!--          Disabled: FLake parameterization. Ideally, the Charnock
    72927291!--          coefficient should depend on the water depth and the fetch
    72937292!--          length
    72947293!             re_0 = z0(j,i) * us(j,i) / molecular_viscosity
    7295 !       
     7294!
    72967295!             z0(j,i) = MAX( 0.1_wp * molecular_viscosity / us(j,i),            &
    72977296!                           alpha_ch * us(j,i) / g )
     
    73377336                flag_exceed_z0h   = .TRUE.
    73387337             ENDIF
    7339  
    7340                                  
     7338
     7339
    73417340          ENDIF
    73427341       ENDDO
     
    73637362
    73647363    END SUBROUTINE calc_z0_water_surface
    7365    
     7364
    73667365
    73677366!------------------------------------------------------------------------------!
    73687367! Description:
    73697368! ------------
    7370 !>  Vertical interpolation and extrapolation of 1D soil profile input from 
    7371 !>  dynamic input file onto the numeric vertical soil grid. 
     7369!>  Vertical interpolation and extrapolation of 1D soil profile input from
     7370!>  dynamic input file onto the numeric vertical soil grid.
    73727371!------------------------------------------------------------------------------!
    73737372    SUBROUTINE interpolate_soil_profile( var, var_file, z_grid, z_file,        &
     
    74527451
    74537452   END FUNCTION psi_h
    7454    
     7453
    74557454 END MODULE land_surface_model_mod
Note: See TracChangeset for help on using the changeset viewer.