Index: palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4118)
+++ palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 4180)
@@ -107,440 +107,4 @@
 ! nopointer option removed
 ! 
-! 3620 2018-12-11 12:29:43Z moh.hefny
-! update the 3d rad_lw_out array
-!
-! 3597 2018-12-04 08:40:18Z maronga 
-! Added pt_2m / theta_2m. Removed unncessary _eb strings.
-! 
-! 3486 2018-11-05 06:20:18Z maronga
-! Bugfix for liquid water treatment on pavements
-! 
-! 3361 2018-10-16 20:39:37Z knoop
-! Bugfix in initialization of soil properties from dynamic input file
-! 
-! 3347 2018-10-15 14:21:08Z suehring
-! Assign real value instead of integer
-! 
-! 3341 2018-10-15 10:31:27Z suehring
-! Modularization of all bulk cloud physics code components
-! 
-! 3271 2018-09-24 08:20:34Z suehring
-! Several bugfixes:
-! - Initialization of pt_surface array with soil temperature in the uppermost
-!   soil layer, else heat fluxes at the very first time step become quite large
-! - Default initialization of vertical surface elements in special case terrain
-!   height changes are larger than adjacent building heights. 
-! 
-! 3256 2018-09-17 12:20:07Z suehring
-! Enable initialization of z0q for vegetation, pavement and water surfaces via
-! namelist input. 
-! 
-! 3248 2018-09-14 09:42:06Z sward
-! Minor formating changes
-! 
-! 3246 2018-09-13 15:14:50Z sward
-! Added error handling for input namelist via parin_fail_message
-! 
-! 3241 2018-09-12 15:02:00Z raasch
-! unused variables removed
-! 
-! 3233 2018-09-07 13:21:24Z schwenkel
-! Adapted for the use of cloud_droplets 
-! 
-! 3222 2018-08-30 13:35:35Z suehring
-! - Introduction of surface array for type and its names
-! - Bugfix in intialization of pavement surfaces
-! 
-! 3215 2018-08-29 09:58:59Z suehring
-! Enable optional initialization of soil properties directly from dynamic 
-! input file.
-! 
-! 3209 2018-08-27 16:58:37Z suehring
-! Added maximum aerodynamic resistance of 300.
-! 
-! 3161 2018-07-23 09:30:10Z maronga
-! Increased roughness of asphalt surfaces to account for turbulence production
-! by traffic and other obstacles
-! 
-! 3152 2018-07-19 13:26:52Z suehring
-! Further adjustments for q_surface
-! 
-! 3147 2018-07-18 22:38:11Z maronga
-! Adjustments for new surface structure
-! 
-! 3146 2018-07-18 22:36:19Z maronga
-! Modified calculation of the surface resistance r_s
-! 
-! 3142 2018-07-17 15:27:45Z suehring
-! Minor bugfix for last commit.
-! 
-! 3138 2018-07-17 08:21:20Z maronga
-! Bugfix: limit roughness lengths in case of sea surface with constant_roughness
-! = .F.
-! 
-! 3136 2018-07-16 14:48:21Z suehring
-! Limit also roughness length for heat and moisture where necessary;
-! Limit surface resistance to positive values
-! 
-! 3133 2018-07-16 11:46:50Z maronga
-! Bugfix for last commit.
-! 
-! Some adjustments for pavement parameters
-! Limit magnus formula to avoid negative q_s (leads to model crash)
-! 
-! 3091 2018-06-28 16:20:35Z suehring
-! Add check for local roughness length not exceeding surface-layer height and
-! limit roughness length where necessary.
-! 
-! 3051 2018-05-30 17:43:55Z suehring
-! Bugfix in surface-element loops for pavement surfaces 
-! 
-! 3045 2018-05-28 07:55:41Z Giersch
-! Error messages revised
-! 
-! 3045 2018-05-28 07:55:41Z Giersch
-! Error messages revised and added
-! 
-! 3026 2018-05-22 10:30:53Z schwenkel
-! Changed the name specific humidity to mixing ratio, since we are computing
-! mixing ratios.
-! 
-! 3014 2018-05-09 08:42:38Z maronga
-! Bugfix: set some initial values
-! Bugfix: domain bounds of local_pf corrected
-! 
-! 3004 2018-04-27 12:33:25Z Giersch
-! Further allocation checks implemented (averaged data will be assigned to fill
-! values if no allocation happened so far) 
-! 
-! 2968 2018-04-13 11:52:24Z suehring
-! Bugfix in initialization in case of elevated model surface
-! 
-! 2963 2018-04-12 14:47:44Z suehring
-! - In initialization of surface types, consider the case that surface_fractions
-!   is not given in static input file.
-! - Introduce index for vegetation/wall, pavement/green-wall and water/window 
-!   surfaces, for clearer access of surface fraction, albedo, emissivity, etc. .
-! 
-! 2938 2018-03-27 15:52:42Z suehring
-! Initialization of soil moisture and temperature via Inifor-provided data also
-! in nested child domains, even if no dynamic input file is available for 
-! child domain. 1D soil profiles are received from parent model.  
-! 
-! 2936 2018-03-27 14:49:27Z suehring
-! renamed lsm_par to land_surface_parameters. Bugfix in message calls
-! 
-! 2921 2018-03-22 15:05:23Z Giersch
-! The activation of spinup has been moved to parin
-! 
-! 2894 2018-03-15 09:17:58Z Giersch
-! Calculations of the index range of the subdomain on file which overlaps with
-! the current subdomain are already done in read_restart_data_mod,
-! lsm_read/write_restart_data was renamed to lsm_r/wrd_local, USE kinds has 
-! been removed in several routines, variable named found has been
-! introduced for checking if restart data was found, reading of restart strings
-! has been moved completely to read_restart_data_mod, lsm_rrd_local is already
-! inside the overlap loop programmed in read_restart_data_mod, the marker ***
-! end lsm *** is not necessary anymore, strings and their respective lengths 
-! are written out and read now in case of restart runs to get rid of prescribed
-! character lengths, SAVE attribute added where necessary, deallocation and 
-! allocation of some arrays have been changed to take care of different restart
-! files that can be opened (index i)
-! 
-! 2881 2018-03-13 16:24:40Z suehring
-! Bugfix: wrong loop structure for soil moisture calculation
-! 
-! 2805 2018-02-14 17:00:09Z suehring
-! Bugfix in initialization of roughness over water surfaces
-! 
-! 2798 2018-02-09 17:16:39Z suehring
-! Minor bugfix for initialization of pt_surface
-! 
-! 2797 2018-02-08 13:24:35Z suehring
-! Move output of ghf to general 2D output to output ghf also at urban-type 
-! surfaces. 
-! Move restart data of ghf_av to read/write_3d_binary, as this is not a 
-! exclusively LSM variable anymore.   
-! 
-! 2765 2018-01-22 11:34:58Z maronga
-! Major bugfix in calculation of f_shf for vertical surfaces
-! 
-! 2735 2018-01-11 12:01:27Z suehring
-! output of r_a moved from land-surface to consider also urban-type surfaces
-! 
-! 2729 2018-01-09 11:22:28Z maronga
-! Separated deep soil temperature from soil_temperature array
-! 
-! 2724 2018-01-05 12:12:38Z maronga
-! Added security check for insufficient soil_temperature values
-! 
-! 2723 2018-01-05 09:27:03Z maronga
-! Bugfix for spinups (end_time was increased twice in case of LSM + USM runs)
-! 
-! 2718 2018-01-02 08:49:38Z maronga
-! Corrected "Former revisions" section
-! 
-! 2707 2017-12-18 18:34:46Z suehring
-! Changes from last commit documented
-! 
-! 2706 2017-12-18 18:33:49Z suehring
-! Bugfix, read surface temperature in case of restart runs.
-!
-! 2705 2017-12-18 11:26:23Z maronga
-! Bugfix in binary output (wrong sequence)
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-! Bugfix: missing USE statement for calc_mean_profile
-! do not write surface temperatures onto pt array as this might cause 
-! problems with nesting (MS)
-! Revised calculation of pt1 and qv1 (now done in surface_layer_fluxes). Bugfix
-! in calculation of surface density (cannot be done via an surface non-air 
-! temperature) (BM)
-! Bugfix: g_d was NaN for non-vegetaed surface types (BM)
-! Bugfix initialization of c_veg and lai
-! Revise data output to enable _FillValues
-! Bugfix in calcultion of r_a and rad_net_l (MS)
-! Bugfix: rad_net is not updated in case of radiation_interaction and must thu
-! be calculated again from the radiative fluxes
-! Temporary fix for cases where no soil model is used on some PEs (BM)
-! Revised input and initialization of soil and surface paramters
-! pavement_depth is variable for each surface element
-! radiation quantities belong to surface type now
-! surface fractions initialized
-! Rename lsm_last_actions into lsm_wrd_subdomain (MS)
-! 
-! 2608 2017-11-13 14:04:26Z schwenkel
-! Calculation of magnus equation in external module (diagnostic_quantities_mod).
-! Adjust calculation of vapor pressure and saturation mixing ratio that it is
-! consistent with formulations in other parts of PALM.
-! 
-! 2575 2017-10-24 09:57:58Z maronga
-! Pavement parameterization revised
-! 
-! 2573 2017-10-20 15:57:49Z scharf
-! bugfixes in last_actions
-! 
-! 2548 2017-10-16 13:18:20Z suehring
-! extended by cloud_droplets option
-! 
-! 2532 2017-10-11 16:00:46Z scharf
-! bugfixes in data_output_3d
-! 
-! 2516 2017-10-04 11:03:04Z suehring
-! Remove tabs
-! 
-! 2514 2017-10-04 09:52:37Z suehring
-! upper bounds of cross section and 3d output changed from nx+1,ny+1 to nx,ny
-! no output of ghost layer data
-! 
-! 2504 2017-09-27 10:36:13Z maronga
-! Support roots and water under pavement. Added several pavement types.
-! 
-! 2476 2017-09-18 07:54:32Z maronga
-! Bugfix for last commit
-! 
-! 2475 2017-09-18 07:42:36Z maronga
-! Bugfix: setting of vegetation_pars for bare soil corrected.
-! 
-! 2354 2017-08-17 10:49:36Z schwenkel
-! minor bugfixes
-! 
-! 2340 2017-08-07 17:11:13Z maronga
-! Revised root_distribution tabel and implemented a pseudo-generic root fraction
-! calculation
-! 
-! 2333 2017-08-04 09:08:26Z maronga
-! minor bugfixes
-! 
-! 2332 2017-08-03 21:15:22Z maronga
-! bugfix in pavement_pars
-! 
-! 2328 2017-08-03 12:34:22Z maronga
-! Revised skin layer concept.
-! Bugfix for runs with pavement surface and humidity
-! Revised some standard values in vegetation_pars
-! Added emissivity and default albedo_type as variable to tables
-! Changed default surface type to vegetation
-! Revised input of soil layer configuration
-! 
-! 2307 2017-07-07 11:32:10Z suehring
-! Bugfix, variable names corrected
-! 
-! 2299 2017-06-29 10:14:38Z maronga
-! Removed pt_p from USE statement. Adjusted call to lsm_soil_model to allow
-! spinups without soil moisture prediction
-! 
-! 2298 2017-06-29 09:28:18Z raasch
-! type of write_binary changed from CHARACTER to LOGICAL
-! 
-! 2296 2017-06-28 07:53:56Z maronga
-! Bugfix in calculation of bare soil heat capacity.
-! Bugfix in calculation of shf
-! Added support for spinups
-! 
-! 2282 2017-06-13 11:38:46Z schwenkel
-! Bugfix for check of saturation moisture
-! 
-! 2273 2017-06-09 12:46:06Z sward
-! Error number changed
-! 
-! 2270 2017-06-09 12:18:47Z maronga
-! Revised parameterization of heat conductivity between skin layer and soil.
-! Temperature and moisture are now defined at the center of the layers.
-! Renamed veg_type to vegetation_type and pave_type to pavement_type_name
-! Renamed and reduced the number of look-up tables (vegetation_pars, soil_pars)
-! Revised land surface model initialization
-! Removed output of shf_eb and qsws_eb and removed _eb throughout code
-! Removed Clapp & Hornberger parameterization
-! 
-! 2249 2017-06-06 13:58:01Z sward
-! 
-! 2248 2017-06-06 13:52:54Z sward $
-! Error no changed
-!
-! 2246 2017-06-06 13:09:34Z sward
-! Error no changed
-!
-! Changed soil configuration to 8 layers. The number of soil layers is now
-! freely adjustable via the NAMELIST.
-! 
-! 2237 2017-05-31 10:34:53Z suehring
-! Bugfix in write restart data
-! 
-! 2233 2017-05-30 18:08:54Z suehring
-!
-! 2232 2017-05-30 17:47:52Z suehring
-! Adjustments to new topography and surface concept
-!   - now, also vertical walls are possible
-!   - for vertical walls, parametrization of r_a (aerodynamic resisistance) is 
-!     implemented. 
-!
-! Add check for soil moisture, it must not exceed its saturation value.
-! 
-! 2149 2017-02-09 16:57:03Z scharf
-! Land surface parameters II corrected for vegetation_type 18 and 19
-! 
-! 2031 2016-10-21 15:11:58Z knoop
-! renamed variable rho to rho_ocean
-! 
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1978 2016-07-29 12:08:31Z maronga
-! Bugfix: initial values of pave_surface and water_surface were not set.
-! 
-! 1976 2016-07-27 13:28:04Z maronga
-! Parts of the code have been reformatted. Use of radiation model output is
-! generalized and simplified. Added more output quantities due to modularization
-! 
-! 1972 2016-07-26 07:52:02Z maronga
-! Further modularization: output of cross sections and 3D data is now done in this
-! module. Moreover, restart data is written and read directly within this module.
-!
-! 
-! 1966 2016-07-18 11:54:18Z maronga
-! Bugfix: calculation of m_total in soil model was not set to zero at model start
-! 
-! 1949 2016-06-17 07:19:16Z maronga
-! Bugfix: calculation of qsws_soil_eb with precipitation = .TRUE. gave
-! qsws_soil_eb = 0 due to a typo
-! 
-! 1856 2016-04-13 12:56:17Z maronga
-! Bugfix: for water surfaces, the initial water surface temperature is set equal
-! to the intital skin temperature. Moreover, the minimum value of r_a is now
-! 1.0 to avoid too large fluxes at the first model time step
-! 
-! 1849 2016-04-08 11:33:18Z hoffmann
-! prr moved to arrays_3d
-!
-! 1826 2016-04-07 12:01:39Z maronga
-! Cleanup after modularization
-! 
-! 1817 2016-04-06 15:44:20Z maronga
-! Added interface for lsm_init_arrays. Added subroutines for check_parameters,
-! header, and parin. Renamed some subroutines.
-! 
-! 1788 2016-03-10 11:01:04Z maronga
-! Bugfix: calculate lambda_surface based on temperature gradient between skin
-! layer and soil layer instead of Obukhov length
-! Changed: moved calculation of surface specific humidity to energy balance solver
-! New: water surfaces are available by using a fixed sea surface temperature.
-! The roughness lengths are calculated dynamically using the Charnock 
-! parameterization. This involves the new roughness length for moisture z0q.
-! New: modified solution of the energy balance solver and soil model for
-! paved surfaces (i.e. asphalt concrete).
-! Syntax layout improved.
-! Changed: parameter dewfall removed.
-! 
-! 1783 2016-03-06 18:36:17Z raasch
-! netcdf variables moved to netcdf module
-!
-! 1757 2016-02-22 15:49:32Z maronga
-! Bugfix: set tm_soil_m to zero after allocation. Added parameter 
-! unscheduled_radiation_calls to control calls of the radiation model based on
-! the skin temperature change during one time step (preliminary version). Set 
-! qsws_soil_eb to zero at model start (previously set to qsws_eb). Removed MAX
-! function as it cannot be vectorized.
-! 
-! 1709 2015-11-04 14:47:01Z maronga
-! Renamed pt_1 and qv_1 to pt1 and qv1.
-! Bugfix: set initial values for t_surface_p in case of restart runs
-! Bugfix: zero resistance caused crash when using radiation_scheme = 'clear-sky'
-! Bugfix: calculation of rad_net when using radiation_scheme = 'clear-sky'
-! Added todo action
-!
-! 1697 2015-10-28 17:14:10Z raasch
-! bugfix: misplaced cpp-directive
-!
-! 1695 2015-10-27 10:03:11Z maronga
-! Bugfix: REAL constants provided with KIND-attribute in call of 
-! Replaced rif with ol
-! 
-! 1691 2015-10-26 16:17:44Z maronga
-! Added skip_time_do_lsm to allow for spin-ups without LSM. Various bugfixes:
-! Soil temperatures are now defined at the edges of the layers, calculation of
-! shb_eb corrected, prognostic equation for skin temperature corrected. Surface
-! fluxes are now directly transfered to atmosphere
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1590 2015-05-08 13:56:27Z maronga
-! Bugfix: definition of character strings requires same length for all elements
-! 
-! 1585 2015-04-30 07:05:52Z maronga
-! Modifications for RRTMG. Changed tables to PARAMETER type. 
-! 
-! 1571 2015-03-12 16:12:49Z maronga
-! Removed upper-case variable names. Corrected distribution of precipitation to 
-! the liquid water reservoir and the bare soil fractions.
-! 
-! 1555 2015-03-04 17:44:27Z maronga
-! Added output of r_a and r_s
-! 
-! 1553 2015-03-03 17:33:54Z maronga
-! Improved better treatment of roughness lengths. Added default soil temperature
-! profile
-! 
-! 1551 2015-03-03 14:18:16Z maronga
-! Flux calculation is now done in prandtl_fluxes. Added support for data output.
-! Vertical indices have been replaced. Restart runs are now possible. Some
-! variables have beem renamed. Bugfix in the prognostic equation for the surface
-! temperature. Introduced z0_eb and z0h_eb, which overwrite the setting of
-! roughness_length and z0_factor. Added Clapp & Hornberger parametrization for
-! the hydraulic conductivity. Bugfix for root fraction and extraction
-! calculation
-! 
-! intrinsic function MAX and MIN
-!
-! 1500 2014-12-03 17:42:41Z maronga
-! Corrected calculation of aerodynamic resistance (r_a).
-! Precipitation is now added to liquid water reservoir using LE_liq.
-! Added support for dry runs.
-! 
-! 1496 2014-12-02 17:25:50Z maronga
-! Initial revision
-! 
 !
 ! Description:
