Index: palm/trunk/SOURCE/biometeorology_mod.f90
===================================================================
--- palm/trunk/SOURCE/biometeorology_mod.f90	(revision 3582)
+++ palm/trunk/SOURCE/biometeorology_mod.f90	(revision 3593)
@@ -27,4 +27,8 @@
 ! -----------------
 ! $Id$
+! Bugfix: additional tmrt_grid allocation in case bio_mrt not selected as ouput,
+! replace degree symbol by degree_C
+! 
+! 3582 2018-11-29 19:16:36Z suehring
 ! Consistently use bio_fill_value everywhere,
 ! move allocation and initialization of output variables to bio_check_data_output
@@ -128,14 +132,14 @@
 !
 !-- Declare all global variables within the module (alphabetical order)
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  tmrt_grid  !< tmrt results (Â°C)
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  perct      !< PT results   (Â°C)
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  utci       !< UTCI results (Â°C)
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pet        !< PET results  (Â°C)
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  tmrt_grid  !< tmrt results (degree_C)
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  perct      !< PT results   (degree_C)
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  utci       !< UTCI results (degree_C)
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pet        !< PET results  (degree_C)
 !
 !-- Grids for averaged thermal indices
     REAL(wp), DIMENSION(:), ALLOCATABLE   ::  mrt_av_grid   !< time average mean
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  perct_av      !< PT results (aver. input)   (Â°C)
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  utci_av       !< UTCI results (aver. input) (Â°C)
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pet_av        !< PET results (aver. input)  (Â°C)
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  perct_av      !< PT results (aver. input)   (degree_C)
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  utci_av       !< UTCI results (aver. input) (degree_C)
+    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pet_av        !< PET results (aver. input)  (degree_C)
 
 
@@ -636,5 +640,5 @@
 !
 !-- Allocate a temporary array with the desired output dimensions.
-       CASE ( 'bio_mrt')
+       CASE ( 'bio_mrt' )
           unit = 'degree_C'
           IF ( .NOT. ALLOCATED( tmrt_grid ) )  THEN
@@ -1185,7 +1189,12 @@
 
 !
-!-- Calculate biometeorology MRT from local radiation
-!   fluxes calculated by RTM and assign into 2D grid
-    tmrt_grid = bio_fill_value
+!-- Calculate biometeorology MRT from local radiation fluxes calculated by RTM and assign
+!-- into 2D grid. Depending on selected output quantities, tmrt_grid might not have been
+!-- allocated in bio_check_data_output yet.
+    IF ( .NOT. ALLOCATED( tmrt_grid ) )  THEN
+       ALLOCATE( tmrt_grid (nys:nyn,nxl:nxr) )
+    ENDIF
+    tmrt_grid = REAL( bio_fill_value, KIND = wp )
+
     DO  l = 1, nmrtbl
        i = mrtbl(ix,l)
@@ -1224,6 +1233,6 @@
 !
 !-- Output parameters
-    REAL(wp), INTENT ( OUT )    ::  tmrt  !< Mean radiant temperature        (Â°C)
-    REAL(wp), INTENT ( OUT )    ::  ta    !< Air temperature                 (Â°C)
+    REAL(wp), INTENT ( OUT )    ::  tmrt  !< Mean radiant temperature        (degree_C)
+    REAL(wp), INTENT ( OUT )    ::  ta    !< Air temperature                 (degree_C)
     REAL(wp), INTENT ( OUT )    ::  vp    !< Vapour pressure                 (hPa)
     REAL(wp), INTENT ( OUT )    ::  ws    !< Wind speed    (local level)     (m/s)
@@ -1322,12 +1331,12 @@
 
     REAL(wp) ::  clo          !< Clothing index                (no dimension)
-    REAL(wp) ::  ta           !< Air temperature                  (Â°C)
+    REAL(wp) ::  ta           !< Air temperature                  (degree_C)
     REAL(wp) ::  vp           !< Vapour pressure                  (hPa)
     REAL(wp) ::  ws           !< Wind speed    (local level)      (m/s)
     REAL(wp) ::  pair         !< Air pressure                     (hPa)
-    REAL(wp) ::  perct_ij     !< Perceived temperature            (Â°C)
-    REAL(wp) ::  utci_ij      !< Universal thermal climate index  (Â°C)
-    REAL(wp) ::  pet_ij       !< Physiologically equivalent temperature  (Â°C)
-    REAL(wp) ::  tmrt_ij      !< Mean radiant temperature         (Â°C)
+    REAL(wp) ::  perct_ij     !< Perceived temperature            (degree_C)
+    REAL(wp) ::  utci_ij      !< Universal thermal climate index  (degree_C)
+    REAL(wp) ::  pet_ij       !< Physiologically equivalent temperature  (degree_C)
+    REAL(wp) ::  tmrt_ij      !< Mean radiant temperature         (degree_C)
 
 !
@@ -1423,9 +1432,9 @@
 !
 !-- Input parameters
-    REAL(wp), INTENT ( IN )  ::  ta   !< Air temperature                  (Â°C)
+    REAL(wp), INTENT ( IN )  ::  ta   !< Air temperature                  (degree_C)
     REAL(wp), INTENT ( IN )  ::  vp   !< Vapour pressure                  (hPa)
     REAL(wp), INTENT ( IN )  ::  ws   !< Wind speed    (local level)      (m/s)
     REAL(wp), INTENT ( IN )  ::  pair !< Air pressure                     (hPa)
-    REAL(wp), INTENT ( IN )  ::  tmrt !< Mean radiant temperature         (Â°C)
+    REAL(wp), INTENT ( IN )  ::  tmrt !< Mean radiant temperature         (degree_C)
     REAL(wp), INTENT ( IN )  ::  dt   !< Time past since last calculation (s)
     REAL(wp), INTENT ( IN )  ::  age  !< Age of agent                     (y)
@@ -1438,5 +1447,5 @@
 !-- Both, input and output parameters
     Real(wp), INTENT ( INOUT )  ::  energy_storage    !< Energy storage   (W/mÂ²)
-    Real(wp), INTENT ( INOUT )  ::  t_clo   !< Clothing temperature       (Â°C)
+    Real(wp), INTENT ( INOUT )  ::  t_clo   !< Clothing temperature       (degree_C)
     Real(wp), INTENT ( INOUT )  ::  clo     !< Current clothing in sulation
     Real(wp), INTENT ( INOUT )  ::  actlev  !< Individuals activity level
@@ -1444,5 +1453,5 @@
 !
 !-- Output parameters
-    REAL(wp), INTENT ( OUT ) ::  ipt    !< Instationary perceived temp.   (Â°C)
+    REAL(wp), INTENT ( OUT ) ::  ipt    !< Instationary perceived temp.   (degree_C)
 !
 !-- If clo equals the initial value, this is the initial call
@@ -1484,18 +1493,18 @@
 !
 !-- Type of input of the argument list
-    REAL(WP), INTENT ( IN )  ::  ta_in    !< Local air temperature (Â°C)
+    REAL(WP), INTENT ( IN )  ::  ta_in    !< Local air temperature (degree_C)
     REAL(WP), INTENT ( IN )  ::  vp       !< Loacl vapour pressure (hPa)
     REAL(WP), INTENT ( IN )  ::  ws_hag   !< Incident wind speed (m/s)
-    REAL(WP), INTENT ( IN )  ::  tmrt     !< Local mean radiant temperature (Â°C)
+    REAL(WP), INTENT ( IN )  ::  tmrt     !< Local mean radiant temperature (degree_C)
     REAL(WP), INTENT ( IN )  ::  hag      !< Height of wind speed input (m)
 !
 !-- Type of output of the argument list
-    REAL(wp), INTENT ( OUT ) ::  utci_ij  !< Universal Thermal Climate Index (Â°C)
-
-    REAL(WP) ::  ta           !< air temperature modified by offset (Â°C)
+    REAL(wp), INTENT ( OUT ) ::  utci_ij  !< Universal Thermal Climate Index (degree_C)
+
+    REAL(WP) ::  ta           !< air temperature modified by offset (degree_C)
     REAL(WP) ::  pa           !< air pressure in kPa      (kPa)
-    REAL(WP) ::  d_tmrt       !< delta-tmrt               (Â°C)
+    REAL(WP) ::  d_tmrt       !< delta-tmrt               (degree_C)
     REAL(WP) ::  va           !< wind speed at 10 m above ground level    (m/s)
-    REAL(WP) ::  offset       !< utci deviation by ta cond. exceeded      (Â°C)
+    REAL(WP) ::  offset       !< utci deviation by ta cond. exceeded      (degree_C)
     REAL(WP) ::  part_ta      !< Air temperature related part of the regression
     REAL(WP) ::  ta2          !< 2 times ta
@@ -1823,5 +1832,5 @@
 ! Description:
 ! ------------
-!> calculate_perct_static: Estimation of perceived temperature (PT, degC)
+!> calculate_perct_static: Estimation of perceived temperature (PT, degree_C)
 !> Value of perct is the Perceived Temperature, degree centigrade
 !------------------------------------------------------------------------------!
@@ -1860,8 +1869,8 @@
     REAL(wp) ::  pmv_s          !< Fangers predicted mean vote for summer clothing
     REAL(wp) ::  pmva           !< adjusted predicted mean vote
-    REAL(wp) ::  ptc            !< perceived temp. for cold conditions (Â°C)
+    REAL(wp) ::  ptc            !< perceived temp. for cold conditions (degree_C)
     REAL(wp) ::  d_std          !< factor to threshold for sultriness
     REAL(wp) ::  pmvs           !< pred. mean vote considering sultrieness
-    REAL(wp) ::  top            !< Gagge's operative temperatures (Â°C)
+    REAL(wp) ::  top            !< Gagge's operative temperatures (degree_C)
 
     INTEGER(iwp) :: ncount      !< running index
@@ -2244,5 +2253,5 @@
     REAL(wp) ::  heat_convection  !< energy loss by autocnvection       (W)
     REAL(wp) ::  activity     !< persons activity  (must stay == actlev, W)
-    REAL(wp) ::  t_skin_aver  !< average skin temperature               (Â°C)
+    REAL(wp) ::  t_skin_aver  !< average skin temperature               (degree_C)
     REAL(wp) ::  bc           !< preliminary result storage
     REAL(wp) ::  cc           !< preliminary result storage
@@ -2250,5 +2259,5 @@
     REAL(wp) ::  ec           !< preliminary result storage
     REAL(wp) ::  gc           !< preliminary result storage
-    REAL(wp) ::  t_clothing   !< clothing temperature                   (Â°C)
+    REAL(wp) ::  t_clothing   !< clothing temperature                   (degree_C)
     REAL(wp) ::  hr           !< radiational heat resistence
     REAL(wp) ::  clo          !< clothing insulation index              (clo)
@@ -2892,8 +2901,8 @@
     REAL(wp), INTENT(in) ::  height     !< Persons height       (m)
     REAL(wp), INTENT(in) ::  work       !< Current workload     (W)
-    REAL(wp), INTENT(in) ::  ta         !< Air Temperature      (Â°C)
+    REAL(wp), INTENT(in) ::  ta         !< Air Temperature      (degree_C)
     REAL(wp), INTENT(in) ::  vp         !< Vapor pressure       (hPa)
     REAL(wp), INTENT(in) ::  ws         !< Wind speed in approx. 1.1m (m/s)
-    REAL(wp), INTENT(in) ::  tmrt       !< Mean radiant temperature   (Â°C)
+    REAL(wp), INTENT(in) ::  tmrt       !< Mean radiant temperature   (degree_C)
     REAL(wp), INTENT(in) ::  pair       !< Air pressure         (hPa)
     REAL(wp), INTENT(in) ::  dt         !< Timestep             (s)
@@ -3084,5 +3093,5 @@
 !> SUBROUTINE ipt_cycle
 !> Calculates one timestep for the instationary version of perceived
-!> temperature (iPT, Â°C) for
+!> temperature (iPT, degree_C) for
 !>  - standard measured/predicted meteorological values and TMRT 
 !>    as input;
@@ -3099,7 +3108,7 @@
 !
 !-- Type of input of the argument list
-    REAL(wp), INTENT ( IN )  ::  ta      !< Air temperature             (Â°C)
+    REAL(wp), INTENT ( IN )  ::  ta      !< Air temperature             (degree_C)
     REAL(wp), INTENT ( IN )  ::  vp      !< Vapor pressure              (hPa)
-    REAL(wp), INTENT ( IN )  ::  tmrt    !< Mean radiant temperature    (Â°C)
+    REAL(wp), INTENT ( IN )  ::  tmrt    !< Mean radiant temperature    (degree_C)
     REAL(wp), INTENT ( IN )  ::  ws      !< Wind speed                  (m/s)
     REAL(wp), INTENT ( IN )  ::  pair    !< Air pressure                (hPa)
@@ -3111,8 +3120,8 @@
 !-- In and output parameters
     REAL(wp), INTENT (INOUT) ::  storage     !< Heat storage            (W)
-    REAL(wp), INTENT (INOUT) ::  t_clothing  !< Clothig temperature     (Â°C)
+    REAL(wp), INTENT (INOUT) ::  t_clothing  !< Clothig temperature     (degree_C)
 !
 !-- Type of output of the argument list
-    REAL(wp), INTENT ( OUT ) ::  ipt  !< Instationary perceived temperature (Â°C)
+    REAL(wp), INTENT ( OUT ) ::  ipt  !< Instationary perceived temperature (degree_C)
 !
 !-- Type of internal variables
@@ -3191,6 +3200,6 @@
 !
 !--  Input argument types
-    REAL(wp), INTENT ( IN )  ::  ta       !< Air temperature          (Â°C)
-    REAL(wp), INTENT ( IN )  ::  tmrt     !< Mean radiant temperature (Â°C)
+    REAL(wp), INTENT ( IN )  ::  ta       !< Air temperature          (degree_C)
+    REAL(wp), INTENT ( IN )  ::  tmrt     !< Mean radiant temperature (degree_C)
     REAL(wp), INTENT ( IN )  ::  pa       !< Vapour pressure          (hPa)
     REAL(wp), INTENT ( IN )  ::  pair     !< Air pressure             (hPa)
@@ -3205,5 +3214,5 @@
 
     REAL(wp), INTENT (INOUT) ::  s  !< storage var. of energy balance (W/m2)
-    REAL(wp), INTENT (INOUT) ::  t_cloth  !< clothing temperature (Â°C)
+    REAL(wp), INTENT (INOUT) ::  t_cloth  !< clothing temperature (degree_C)
 !
 !-- Internal variables
@@ -3212,5 +3221,5 @@
     REAL(wp) ::  f_cl         !< Increase in surface due to clothing    (factor)
     REAL(wp) ::  heat_convection  !< energy loss by autocnvection       (W)
-    REAL(wp) ::  t_skin_aver  !< average skin temperature               (Â°C)
+    REAL(wp) ::  t_skin_aver  !< average skin temperature               (degree_C)
     REAL(wp) ::  bc           !< preliminary result storage
     REAL(wp) ::  cc           !< preliminary result storage
@@ -3218,5 +3227,5 @@
     REAL(wp) ::  ec           !< preliminary result storage
     REAL(wp) ::  gc           !< preliminary result storage
-    REAL(wp) ::  t_clothing   !< clothing temperature                   (Â°C)
+    REAL(wp) ::  t_clothing   !< clothing temperature                   (degree_C)
 !     REAL(wp) ::  hr           !< radiational heat resistence
     REAL(wp) ::  clo          !< clothing insulation index              (clo)
@@ -3338,6 +3347,6 @@
 !
 !-- Input arguments:
-    REAL(wp), INTENT( IN ) ::  ta    !< Air temperature             (Â°C)
-    REAL(wp), INTENT( IN ) ::  tmrt  !< Mean radiant temperature    (Â°C)
+    REAL(wp), INTENT( IN ) ::  ta    !< Air temperature             (degree_C)
+    REAL(wp), INTENT( IN ) ::  tmrt  !< Mean radiant temperature    (degree_C)
     REAL(wp), INTENT( IN ) ::  v     !< Wind speed                  (m/s)
     REAL(wp), INTENT( IN ) ::  vpa   !< Vapor pressure              (hPa)
@@ -3345,5 +3354,5 @@
 !
 !-- Output arguments:
-    REAL(wp), INTENT ( OUT ) ::  pet_ij  !< PET                     (Â°C)
+    REAL(wp), INTENT ( OUT ) ::  pet_ij  !< PET                     (degree_C)
 !
 !-- Internal variables:
@@ -3360,6 +3369,6 @@
     REAL(wp) ::  rtv
     REAL(wp) ::  vpts       !< Sat. vapor pressure over skin        (hPa)
-    REAL(wp) ::  tsk        !< Skin temperature                     (Â°C)
-    REAL(wp) ::  tcl        !< Clothing temperature                 (Â°C)
+    REAL(wp) ::  tsk        !< Skin temperature                     (degree_C)
+    REAL(wp) ::  tcl        !< Clothing temperature                 (degree_C)
     REAL(wp) ::  wetsk      !< Fraction of wet skin                 (factor)
 !
@@ -3412,5 +3421,5 @@
 !-- Input arguments:
     REAL(wp), INTENT( IN )  ::  pair      !< air pressure             (hPa)
-    REAL(wp), INTENT( IN )  ::  ta        !< air temperature          (Â°C)
+    REAL(wp), INTENT( IN )  ::  ta        !< air temperature          (degree_C)
     REAL(wp), INTENT( IN )  ::  vpa       !< vapor pressure           (hPa)
     REAL(wp), INTENT( IN )  ::  age       !< Persons age              (a)
@@ -3474,6 +3483,6 @@
     REAL(wp), INTENT( IN )  ::  int_heat  !< internal heat production (W)
     REAL(wp), INTENT( IN )  ::  pair   !< Air pressure             (hPa)
-    REAL(wp), INTENT( IN )  ::  ta     !< Air temperature          (Â°C)
-    REAL(wp), INTENT( IN )  ::  tmrt   !< Mean radiant temperature (Â°C)
+    REAL(wp), INTENT( IN )  ::  ta     !< Air temperature          (degree_C)
+    REAL(wp), INTENT( IN )  ::  tmrt   !< Mean radiant temperature (degree_C)
     REAL(wp), INTENT( IN )  ::  v      !< Wind speed               (m/s)
     REAL(wp), INTENT( IN )  ::  vpa    !< Vapor pressure           (hPa)
@@ -3492,6 +3501,6 @@
     REAL(wp), INTENT( OUT ) ::  rdcl   !< Diffusion resistence of clothing (factor)
     REAL(wp), INTENT( OUT ) ::  rdsk   !< Diffusion resistence of skin (factor)
-    REAL(wp), INTENT( OUT ) ::  tcl    !< Clothing temperature         (Â°C)
-    REAL(wp), INTENT( OUT ) ::  tsk    !< Skin temperature             (Â°C)
+    REAL(wp), INTENT( OUT ) ::  tcl    !< Clothing temperature         (degree_C)
+    REAL(wp), INTENT( OUT ) ::  tsk    !< Skin temperature             (degree_C)
     REAL(wp), INTENT( OUT ) ::  vpts   !< Sat. vapor pressure over skin (hPa)
     REAL(wp), INTENT( OUT ) ::  wetsk  !< Fraction of wet skin (dimensionless)
@@ -3508,5 +3517,5 @@
 !
 !-- Internal variables
-    REAL(wp) ::  c(0:10)        !< Core temperature array           (Â°C)
+    REAL(wp) ::  c(0:10)        !< Core temperature array           (degree_C)
     REAL(wp) ::  cbare          !< Convection through bare skin
     REAL(wp) ::  cclo           !< Convection through clothing
@@ -3753,7 +3762,7 @@
     REAL(wp), INTENT( IN ) ::  rdsk  !< diffusion resistence of skin (factor)
     REAL(wp), INTENT( IN ) ::  rtv   !< respiratory volume
-    REAL(wp), INTENT( IN ) ::  ta    !< air temperature              (Â°C)
-    REAL(wp), INTENT( IN ) ::  tcl   !< clothing temperature         (Â°C)
-    REAL(wp), INTENT( IN ) ::  tsk   !< skin temperature             (Â°C)
+    REAL(wp), INTENT( IN ) ::  ta    !< air temperature              (degree_C)
+    REAL(wp), INTENT( IN ) ::  tcl   !< clothing temperature         (degree_C)
+    REAL(wp), INTENT( IN ) ::  tsk   !< skin temperature             (degree_C)
     REAL(wp), INTENT( IN ) ::  vpts  !< sat. vapor pressure over skin (hPa)
     REAL(wp), INTENT( IN ) ::  wetsk !< fraction of wet skin (dimensionless)
@@ -3761,5 +3770,5 @@
 !-- Output arguments:
     REAL(wp), INTENT( OUT ) ::  aeff     !< effective surface area       (mÂ²)
-    REAL(wp), INTENT( OUT ) ::  pet_ij   !< PET                          (Â°C)
+    REAL(wp), INTENT( OUT ) ::  pet_ij   !< PET                          (degree_C)
 !
 !-- Cconstants:
@@ -3782,5 +3791,5 @@
     REAL ( wp ) ::  rclo              !< Radiational loss of clothing   (W/mÂ²)
     REAL ( wp ) ::  rsum              !< Radiational loss or gain       (W/mÂ²)
-    REAL ( wp ) ::  tex               !< Temperat. of exhaled air       (Â°C)
+    REAL ( wp ) ::  tex               !< Temperat. of exhaled air       (degree_C)
     REAL ( wp ) ::  vpex              !< Vapor pressure of exhaled air  (hPa)
     REAL ( wp ) ::  xx                !< Delta PET per iteration        (K)
