Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4179)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4180)
@@ -143,501 +143,4 @@
 ! 3655 2019-01-07 16:51:22Z knoop
 ! nopointer option removed
-! 
-! 3633 2018-12-17 16:17:57Z schwenkel
-! Include check for rrtmg files
-! 
-! 3630 2018-12-17 11:04:17Z knoop
-! - fix initialization of date and time after calling zenith
-! - fix a bug in radiation_solar_pos
-!
-! 3616 2018-12-10 09:44:36Z Salim
-! fix manipulation of time variables in radiation_presimulate_solar_pos
-!
-! 3608 2018-12-07 12:59:57Z suehring $
-! Bugfix radiation output
-! 
-! 3607 2018-12-07 11:56:58Z suehring
-! Output of radiation-related quantities migrated to radiation_model_mod.
-! 
-! 3589 2018-11-30 15:09:51Z suehring
-! Remove erroneous UTF encoding
-! 
-! 3572 2018-11-28 11:40:28Z suehring
-! Add filling the short- and longwave radiation flux arrays (e.g. diffuse, 
-! direct, reflected, resedual) for all surfaces. This is required to surface
-! outputs in suface_output_mod. (M. Salim)
-! 
-! 3571 2018-11-28 09:24:03Z moh.hefny
-! Add an epsilon value to compare values in if statement to fix possible 
-! precsion related errors in raytrace routines.
-! 
-! 3524 2018-11-14 13:36:44Z raasch
-! missing cpp-directives added
-! 
-! 3495 2018-11-06 15:22:17Z kanani
-! Resort control_parameters ONLY list,
-! From branch radiation@3491 moh.hefny:
-! bugfix in calculating the apparent solar positions by updating 
-! the simulated time so that the actual time is correct.
-! 
-! 3464 2018-10-30 18:08:55Z kanani
-! From branch resler@3462, pavelkrc:
-! add MRT shaping function for human
-! 
-! 3449 2018-10-29 19:36:56Z suehring
-! New RTM version 3.0: (Pavel Krc, Jaroslav Resler, ICS, Prague)
-!   - Interaction of plant canopy with LW radiation
-!   - Transpiration from resolved plant canopy dependent on radiation
-!     called from RTM
-! 
-! 
-! 3435 2018-10-26 18:25:44Z gronemeier
-! - workaround: return unit=illegal in check_data_output for certain variables
-!   when check called from init_masks
-! - Use pointer in masked output to reduce code redundancies
-! - Add terrain-following masked output
-! 
-! 3424 2018-10-25 07:29:10Z gronemeier
-! bugfix: add rad_lw_in, rad_lw_out, rad_sw_out to radiation_check_data_output
-! 
-! 3378 2018-10-19 12:34:59Z kanani
-! merge from radiation branch (r3362) into trunk
-! (moh.hefny):
-! - removed read/write_svf_on_init and read_dist_max_svf (not used anymore)
-! - bugfix nzut > nzpt in calculating maxboxes
-! 
-! 3372 2018-10-18 14:03:19Z raasch
-! bugfix: kind type of 2nd argument of mpi_win_allocate changed, misplaced
-!         __parallel directive
-! 
-! 3351 2018-10-15 18:40:42Z suehring
-! Do not overwrite values of spectral and broadband albedo during initialization
-! if they are already initialized in the urban-surface model via ASCII input.
-! 
-! 3337 2018-10-12 15:17:09Z kanani
-! - New RTM version 2.9: (Pavel Krc, Jaroslav Resler, ICS, Prague)
-!   added calculation of the MRT inside the RTM module
-!   MRT fluxes are consequently used in the new biometeorology module
-!   for calculation of biological indices (MRT, PET)
-!   Fixes of v. 2.5 and SVN trunk:
-!    - proper initialization of rad_net_l
-!    - make arrays nsurfs and surfstart TARGET to prevent some MPI problems
-!    - initialization of arrays used in MPI one-sided operation as 1-D arrays
-!      to prevent problems with some MPI/compiler combinations
-!    - fix indexing of target displacement in subroutine request_itarget to 
-!      consider nzub
-!    - fix LAD dimmension range in PCB calculation
-!    - check ierr in all MPI calls
-!    - use proper per-gridbox sky and diffuse irradiance
-!    - fix shading for reflected irradiance
-!    - clear away the residuals of "atmospheric surfaces" implementation
-!    - fix rounding bug in raytrace_2d introduced in SVN trunk
-! - New RTM version 2.5: (Pavel Krc, Jaroslav Resler, ICS, Prague)
-!   can use angular discretization for all SVF
-!   (i.e. reflected and emitted radiation in addition to direct and diffuse),
-!   allowing for much better scaling wih high resoltion and/or complex terrain
-! - Unite array grow factors
-! - Fix slightly shifted terrain height in raytrace_2d
-! - Use more efficient MPI_Win_allocate for reverse gridsurf index
-! - Fix random MPI RMA bugs on Intel compilers
-! - Fix approx. double plant canopy sink values for reflected radiation
-! - Fix mostly missing plant canopy sinks for direct radiation
-! - Fix discretization errors for plant canopy sink in diffuse radiation
-! - Fix rounding errors in raytrace_2d
-!
-! 3274 2018-09-24 15:42:55Z knoop
-! Modularization of all bulk cloud physics code components
-! 
-! 3272 2018-09-24 10:16:32Z suehring
-! - split direct and diffusion shortwave radiation using RRTMG rather than using
-!   calc_diffusion_radiation, in case of RRTMG
-! - removed the namelist variable split_diffusion_radiation. Now splitting depends
-!   on the choise of radiation radiation scheme
-! - removed calculating the rdiation flux for surfaces at the radiation scheme
-!   in case of using RTM since it will be calculated anyway in the radiation 
-!   interaction routine.
-! - set SW radiation flux for surfaces to zero at night in case of no RTM is used
-! - precalculate the unit vector yxdir of ray direction to avoid the temporarly 
-!   array allocation during the subroutine call
-! - fixed a bug in calculating the max number of boxes ray can cross in the domain
-! 
-! 3264 2018-09-20 13:54:11Z moh.hefny
-! Bugfix in raytrace_2d calls
-! 
-! 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 or commented
-! 
-! 3233 2018-09-07 13:21:24Z schwenkel
-! Adapted for the use of cloud_droplets 
-! 
-! 3230 2018-09-05 09:29:05Z schwenkel
-! Bugfix in radiation_constant_surf: changed (10.0 - emissivity_urb) to 
-! (1.0 - emissivity_urb)
-! 
-! 3226 2018-08-31 12:27:09Z suehring
-! Bugfixes in calculation of sky-view factors and canopy-sink factors.
-! 
-! 3186 2018-07-30 17:07:14Z suehring
-! Remove print statement
-! 
-! 3180 2018-07-27 11:00:56Z suehring
-! Revise concept for calculation of effective radiative temperature and mapping
-! of radiative heating
-! 
-! 3175 2018-07-26 14:07:38Z suehring
-! Bugfix for commit 3172
-! 
-! 3173 2018-07-26 12:55:23Z suehring
-! Revise output of surface radiation quantities in case of overhanging 
-! structures
-! 
-! 3172 2018-07-26 12:06:06Z suehring
-! Bugfixes:
-!  - temporal work-around for calculation of effective radiative surface 
-!    temperature
-!  - prevent positive solar radiation during nighttime
-! 
-! 3170 2018-07-25 15:19:37Z suehring
-! Bugfix, map signle-column radiation forcing profiles on top of any topography
-! 
-! 3156 2018-07-19 16:30:54Z knoop
-! Bugfix: replaced usage of the pt array with the surf%pt_surface array
-!
-! 3137 2018-07-17 06:44:21Z maronga
-! String length for trace_names fixed
-! 
-! 3127 2018-07-15 08:01:25Z maronga
-! A few pavement parameters updated.
-! 
-! 3123 2018-07-12 16:21:53Z suehring
-! Correct working precision for INTEGER number
-! 
-! 3122 2018-07-11 21:46:41Z maronga
-! Bugfix: maximum distance for raytracing was set to  -999 m by default,
-! effectively switching off all surface reflections when max_raytracing_dist
-! was not explicitly set in namelist
-! 
-! 3117 2018-07-11 09:59:11Z maronga
-! Bugfix: water vapor was not transfered to RRTMG when bulk_cloud_model = .F.
-! Bugfix: changed the calculation of RRTMG boundary conditions (Mohamed Salim)
-! Bugfix: dry residual atmosphere is replaced by standard RRTMG atmosphere
-! 
-! 3116 2018-07-10 14:31:58Z suehring
-! Output of long/shortwave radiation at surface
-! 
-! 3107 2018-07-06 15:55:51Z suehring
-! Bugfix, missing index for dz
-! 
-! 3066 2018-06-12 08:55:55Z Giersch
-! Error message revised 
-! 
-! 3065 2018-06-12 07:03:02Z Giersch
-! dz was replaced by dz(1), error message concerning vertical stretching was 
-! added  
-! 
-! 3049 2018-05-29 13:52:36Z Giersch
-! Error messages revised
-! 
-! 3045 2018-05-28 07:55:41Z Giersch
-! Error message revised
-! 
-! 3026 2018-05-22 10:30:53Z schwenkel
-! Changed the name specific humidity to mixing ratio, since we are computing
-! mixing ratios.
-! 
-! 3016 2018-05-09 10:53:37Z Giersch
-! Revised structure of reading svf data according to PALM coding standard: 
-! svf_code_field/len and fsvf removed, error messages PA0493 and PA0494 added,
-! allocation status of output arrays checked. 
-! 
-! 3014 2018-05-09 08:42:38Z maronga
-! Introduced plant canopy height similar to urban canopy height to limit
-! the memory requirement to allocate lad.
-! Deactivated automatic setting of minimum raytracing distance.
-! 
-! 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) 
-! 
-! 2995 2018-04-19 12:13:16Z Giersch
-! IF-statement in radiation_init removed so that the calculation of radiative 
-! fluxes at model start is done in any case, bugfix in 
-! radiation_presimulate_solar_pos (end_time is the sum of end_time and the 
-! spinup_time specified in the p3d_file ), list of variables/fields that have
-! to be written out or read in case of restarts has been extended
-! 
-! 2977 2018-04-17 10:27:57Z kanani
-! Implement changes from branch radiation (r2948-2971) with minor modifications,
-! plus some formatting.
-! (moh.hefny):
-! - replaced plant_canopy by npcbl to check tree existence to avoid weird 
-!   allocation of related arrays (after domain decomposition some domains 
-!   contains no trees although plant_canopy (global parameter) is still TRUE).
-! - added a namelist parameter to force RTM settings
-! - enabled the option to switch radiation reflections off
-! - renamed surf_reflections to surface_reflections 
-! - removed average_radiation flag from the namelist (now it is implicitly set 
-!   in init_3d_model according to RTM)
-! - edited read and write sky view factors and CSF routines to account for
-!   the sub-domains which may not contain any of them
-! 
-! 2967 2018-04-13 11:22:08Z raasch
-! bugfix: missing parallel cpp-directives added
-! 
-! 2964 2018-04-12 16:04:03Z Giersch
-! Error message PA0491 has been introduced which could be previously found in 
-! check_open. The variable numprocs_previous_run is only known in case of 
-! initializing_actions == read_restart_data
-! 
-! 2963 2018-04-12 14:47:44Z suehring
-! - Introduce index for vegetation/wall, pavement/green-wall and water/window 
-!   surfaces, for clearer access of surface fraction, albedo, emissivity, etc. .
-! - Minor bugfix in initialization of albedo for window surfaces
-! 
-! 2944 2018-04-03 16:20:18Z suehring
-! Fixed bad commit
-! 
-! 2943 2018-04-03 16:17:10Z suehring
-! No read of nsurfl from SVF file since it is calculated in
-! radiation_interaction_init,
-! allocation of arrays in radiation_read_svf only if not yet allocated,
-! update of 2920 revision comment.
-! 
-! 2932 2018-03-26 09:39:22Z maronga
-! renamed radiation_par to radiation_parameters
-! 
-! 2930 2018-03-23 16:30:46Z suehring
-! Remove default surfaces from radiation model, does not make much sense to 
-! apply radiation model without energy-balance solvers; Further, add check for 
-! this. 
-! 
-! 2920 2018-03-22 11:22:01Z kanani
-! - Bugfix: Initialize pcbl array (=-1)
-! RTM version 2.0 (Jaroslav Resler, Pavel Krc, Mohamed Salim):
-! - new major version of radiation interactions
-! - substantially enhanced performance and scalability
-! - processing of direct and diffuse solar radiation separated from reflected 
-!   radiation, removed virtual surfaces
-! - new type of sky discretization by azimuth and elevation angles
-! - diffuse radiation processed cumulatively using sky view factor
-! - used precalculated apparent solar positions for direct irradiance
-! - added new 2D raytracing process for processing whole vertical column at once
-!   to increase memory efficiency and decrease number of MPI RMA operations
-! - enabled limiting the number of view factors between surfaces by the distance
-!   and value
-! - fixing issues induced by transferring radiation interactions from 
-!   urban_surface_mod to radiation_mod
-! - bugfixes and other minor enhancements
-! 
-! 2906 2018-03-19 08:56:40Z Giersch
-! NAMELIST paramter read/write_svf_on_init have been removed, functions 
-! check_open and close_file are used now for opening/closing files related to
-! svf data, adjusted unit number and error numbers 
-! 
-! 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
-! radiation_read_restart_data was renamed to radiation_rrd_local and 
-! radiation_last_actions was renamed to radiation_wrd_local, 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, 
-! radiation_rrd_local is already inside the overlap loop programmed in 
-! read_restart_data_mod, the marker *** end rad *** 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 (Giersch)
-!
-! 2809 2018-02-15 09:55:58Z suehring
-! Bugfix for gfortran: Replace the function C_SIZEOF with STORAGE_SIZE
-! 
-! 2753 2018-01-16 14:16:49Z suehring
-! Tile approach for spectral albedo implemented. 
-! 
-! 2746 2018-01-15 12:06:04Z suehring
-! Move flag plant canopy to modules
-! 
-! 2724 2018-01-05 12:12:38Z maronga
-! Set default of average_radiation to .FALSE.
-! 
-! 2723 2018-01-05 09:27:03Z maronga
-! Bugfix in calculation of rad_lw_out (clear-sky). First grid level was used
-! instead of the surface value
-! 
-! 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, in average radiation case calculate exner function before using it.
-!
-! 2701 2017-12-15 15:40:50Z suehring
-! Changes from last commit documented
-! 
-! 2698 2017-12-14 18:46:24Z suehring
-! Bugfix in get_topography_top_index
-!
-! 2696 2017-12-14 17:12:51Z kanani
-! - Change in file header (GPL part)
-! - Improved reading/writing of SVF from/to file (BM)
-! - Bugfixes concerning RRTMG as well as average_radiation options (M. Salim)
-! - Revised initialization of surface albedo and some minor bugfixes (MS)
-! - Update net radiation after running radiation interaction routine (MS)
-! - Revisions from M Salim included
-! - Adjustment to topography and surface structure (MS)
-! - Initialization of albedo and surface emissivity via input file (MS)
-! - albedo_pars extended (MS)
-! 
-! 2604 2017-11-06 13:29:00Z schwenkel
-! bugfix for calculation of effective radius using morrison microphysics
-! 
-! 2601 2017-11-02 16:22:46Z scharf
-! added emissivity to namelist
-! 
-! 2575 2017-10-24 09:57:58Z maronga
-! Bugfix: calculation of shortwave and longwave albedos for RRTMG swapped
-! 
-! 2547 2017-10-16 12:41:56Z schwenkel
-! extended by cloud_droplets option, minor bugfix and correct calculation of
-! cloud droplet number concentration
-! 
-! 2544 2017-10-13 18:09:32Z maronga
-! Moved date and time quantitis to separate module date_and_time_mod
-! 
-! 2512 2017-10-04 08:26:59Z raasch
-! 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
-! Updates pavement types and albedo parameters
-! 
-! 2328 2017-08-03 12:34:22Z maronga
-! Emissivity can now be set individually for each pixel.
-! Albedo type can be inferred from land surface model.
-! Added default albedo type for bare soil
-! 
-! 2318 2017-07-20 17:27:44Z suehring
-! Get topography top index via Function call 
-! 
-! 2317 2017-07-20 17:27:19Z suehring
-! Improved syntax layout
-! 
-! 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
-! Added output of rad_sw_out for radiation_scheme = 'constant'
-! 
-! 2270 2017-06-09 12:18:47Z maronga
-! Numbering changed (2 timeseries removed)
-! 
-! 2249 2017-06-06 13:58:01Z sward
-! Allow for RRTMG runs without humidity/cloud physics
-! 
-! 2248 2017-06-06 13:52:54Z sward
-! Error no changed
-! 
-! 2233 2017-05-30 18:08:54Z suehring
-! 
-! 2232 2017-05-30 17:47:52Z suehring
-! Adjustments to new topography concept
-! Bugfix in read restart
-! 
-! 2200 2017-04-11 11:37:51Z suehring
-! Bugfix in call of exchange_horiz_2d and read restart data
-! 
-! 2163 2017-03-01 13:23:15Z schwenkel
-! Bugfix in radiation_check_data_output
-! 
-! 2157 2017-02-22 15:10:35Z suehring
-! Bugfix in read_restart data
-! 
-! 2011 2016-09-19 17:29:57Z kanani
-! Removed CALL of auxiliary SUBROUTINE get_usm_info,
-! flag urban_surface is now defined in module control_parameters.
-! 
-! 2007 2016-08-24 15:47:17Z kanani
-! Added calculation of solar directional vector for new urban surface 
-! model,
-! accounted for urban_surface model in radiation_check_parameters,
-! correction of comments for zenith angle.
-! 
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1976 2016-07-27 13:28:04Z maronga
-! Output of 2D/3D/masked data is now directly done within this module. The
-! radiation schemes have been simplified for better usability so that
-! rad_lw_in, rad_lw_out, rad_sw_in, and rad_sw_out are available independent of
-! the radiation code used.
-! 
-! 1856 2016-04-13 12:56:17Z maronga
-! Bugfix: allocation of rad_lw_out for radiation_scheme = 'clear-sky'
-! 
-! 1853 2016-04-11 09:00:35Z maronga
-! Added routine for radiation_scheme = constant.
-!  
-! 1849 2016-04-08 11:33:18Z hoffmann 
-! Adapted for modularization of microphysics
-!
-! 1826 2016-04-07 12:01:39Z maronga
-! Further modularization.
-! 
-! 1788 2016-03-10 11:01:04Z maronga
-! Added new albedo class for pavements / roads.
-!
-! 1783 2016-03-06 18:36:17Z raasch
-! palm-netcdf-module removed in order to avoid a circular module dependency,
-! netcdf-variables moved to netcdf-module, new routine netcdf_handle_error_rad
-! added
-!
-! 1757 2016-02-22 15:49:32Z maronga
-! Added parameter unscheduled_radiation_calls. Bugfix: interpolation of sounding
-! profiles for pressure and temperature above the LES domain.
-! 
-! 1709 2015-11-04 14:47:01Z maronga
-! Bugfix: set initial value for rrtm_lwuflx_dt to zero, small formatting
-! corrections
-! 
-! 1701 2015-11-02 07:43:04Z maronga
-! Bugfixes: wrong index for output of timeseries, setting of nz_snd_end
-! 
-! 1691 2015-10-26 16:17:44Z maronga
-! Added option for spin-up runs without radiation (skip_time_do_radiation). Bugfix
-! in calculation of pressure profiles. Bugfix in calculation of trace gas profiles.
-! Added output of radiative heating rates.
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
-! 1606 2015-06-29 10:43:37Z maronga
-! Added preprocessor directive __netcdf to allow for compiling without netCDF.
-! Note, however, that RRTMG cannot be used without netCDF.
-! 
-! 1590 2015-05-08 13:56:27Z maronga
-! Bugfix: definition of character strings requires same length for all elements
-! 
-! 1587 2015-05-04 14:19:01Z maronga
-! Added albedo class for snow
-! 
-! 1585 2015-04-30 07:05:52Z maronga
-! Added support for RRTMG
-! 
-! 1571 2015-03-12 16:12:49Z maronga
-! Added missing KIND attribute. Removed upper-case variable names
-! 
-! 1551 2015-03-03 14:18:16Z maronga
-! Added support for data output. Various variables have been renamed. Added
-! interface for different radiation schemes (currently: clear-sky, constant, and
-! RRTM (not yet implemented).
-! 
-! 1496 2014-12-02 17:25:50Z maronga
-! Initial revision
 ! 
 !
