Index: palm/trunk/SOURCE/biometeorology_mod.f90
===================================================================
--- palm/trunk/SOURCE/biometeorology_mod.f90	(revision 3738)
+++ palm/trunk/SOURCE/biometeorology_mod.f90	(revision 3739)
@@ -27,4 +27,12 @@
 ! -----------------
 ! $Id$
+! - Auto-adjusting thermal_comfort flag if not set by user, but thermal_indices
+! set as output quantities.
+! - Renamed flags "bio_<index>" to "do_calculate_<index>" for better readability
+! - Removed everything related to "time_bio_results" as this is never used.
+! - Moved humidity warning to check_data_output
+! - Fixed bug in mrt calculation introduced with my commit yesterday.
+! 
+! 3735 2019-02-12 09:52:40Z dom_dwd_user
 ! - Fixed auto-setting of thermal index calculation flags by output
 !  as originally proposed by resler.
@@ -173,5 +181,4 @@
     INTEGER( iwp ) ::  bio_cell_level     !< cell level biom calculates for
     REAL ( wp )    ::  bio_output_height  !< height output is calculated in m
-    REAL ( wp )    ::  time_bio_results   !< the time, the last set of biom results have been calculated for
     REAL ( wp ), PARAMETER ::  human_absorb = 0.7_wp  !< SW absorbtivity of a human body (Fanger 1972)
     REAL ( wp ), PARAMETER ::  human_emiss = 0.97_wp  !< LW emissivity of a human body after (Fanger 1972)
@@ -189,11 +196,11 @@
     LOGICAL ::  average_trigger_pet   = .FALSE.  !< update averaged input on call to bio_pet?
 
-    LOGICAL ::  thermal_comfort = .FALSE.  !< Turn all thermal indices on or off
-    LOGICAL ::  bio_perct     = .FALSE.   !< Turn index PT (instant. input) on or off
-    LOGICAL ::  bio_perct_av  = .FALSE.   !< Turn index PT (averaged input) on or off
-    LOGICAL ::  bio_pet       = .FALSE.   !< Turn index PET (instant. input) on or off
-    LOGICAL ::  bio_pet_av    = .FALSE.   !< Turn index PET (averaged input) on or off
-    LOGICAL ::  bio_utci      = .FALSE.   !< Turn index UTCI (instant. input) on or off
-    LOGICAL ::  bio_utci_av   = .FALSE.   !< Turn index UTCI (averaged input) on or off
+    LOGICAL ::  thermal_comfort = .FALSE.  !< Enables or disables thermal comfort part
+    LOGICAL ::  do_calculate_perct     = .FALSE.   !< Turn index PT (instant. input) on or off
+    LOGICAL ::  do_calculate_perct_av  = .FALSE.   !< Turn index PT (averaged input) on or off
+    LOGICAL ::  do_calculate_pet       = .FALSE.   !< Turn index PET (instant. input) on or off
+    LOGICAL ::  do_calculate_pet_av    = .FALSE.   !< Turn index PET (averaged input) on or off
+    LOGICAL ::  do_calculate_utci      = .FALSE.   !< Turn index UTCI (instant. input) on or off
+    LOGICAL ::  do_calculate_utci_av   = .FALSE.   !< Turn index UTCI (averaged input) on or off
 
 !
@@ -254,5 +261,5 @@
     bio_check_parameters, bio_data_output_3d, bio_data_output_2d,              &
     bio_define_netcdf_grid, bio_get_thermal_index_input_ij, bio_header,        &
-    bio_init, bio_init_checks, bio_parin, thermal_comfort, time_bio_results,   &
+    bio_init, bio_init_checks, bio_parin, thermal_comfort,                     &
     bio_nmrtbl, bio_wrd_local, bio_rrd_local, bio_wrd_global, bio_rrd_global
 !
@@ -486,10 +493,11 @@
                 IF ( mrt_include_sw )  THEN
                    mrt_av_grid(:) = mrt_av_grid(:) +                           &
-                      (( human_absorb * mrtinsw(:) + human_emiss * mrtinlw(:)) &
-                      / (human_emiss * sigma_sb)) ** .25_wp - degc_to_k
+                      ( ( human_absorb * mrtinsw(:) +                          &
+                      mrtinlw(:) ) /                             &  ! human_emiss * mrtinlw(:) /
+                      ( human_emiss * sigma_sb ) ) ** .25_wp - degc_to_k
                 ELSE
                    mrt_av_grid(:) = mrt_av_grid(:) +                           &
-                      (human_emiss * mrtinlw(:) / sigma_sb) ** .25_wp          &
-                      - degc_to_k
+                      ( mrtinlw(:) /                             &  ! ( human_emiss * mrtinlw(:) /
+                      ( human_emiss * sigma_sb ) ) ** .25_wp - degc_to_k
                 ENDIF
              ENDIF
@@ -559,10 +567,11 @@
                 IF ( mrt_include_sw )  THEN
                    mrt_av_grid(:) = mrt_av_grid(:) +                           &
-                      (( human_absorb * mrtinsw(:) + human_emiss * mrtinlw(:)) &
-                      / (human_emiss * sigma_sb)) ** .25_wp - degc_to_k
+                      ( ( human_absorb * mrtinsw(:) +                          &
+                      mrtinlw(:) ) /                             &  ! human_emiss * mrtinlw(:) /
+                      ( human_emiss * sigma_sb ) ) ** .25_wp - degc_to_k
                 ELSE
                    mrt_av_grid(:) = mrt_av_grid(:) +                           &
-                      (human_emiss * mrtinlw(:) / sigma_sb) ** .25_wp          &
-                      - degc_to_k
+                      ( mrtinlw(:) /                             &  ! ( human_emiss * mrtinlw(:) /
+                      ( human_emiss * sigma_sb ) ) ** .25_wp - degc_to_k
                 ENDIF
              ENDIF
@@ -693,8 +702,8 @@
     CHARACTER (LEN=*) ::  var      !< The variable in question
 
-    INTEGER(iwp) ::  i      !<
-    INTEGER(iwp), INTENT(IN)  :: j   !< average quantity? 0 = no, 1 = yes
-    INTEGER(iwp) ::  ilen   !<   
-    INTEGER(iwp) ::  k      !<
+    INTEGER(iwp), INTENT(IN) ::  i     !< Current element of data_output
+    INTEGER(iwp), INTENT(IN) ::  j     !< Average quantity? 0 = no, 1 = yes
+    INTEGER(iwp), INTENT(IN) ::  ilen  !< Length of current entry in data_output
+    INTEGER(iwp), INTENT(IN) ::  k     !< Output is xy mode? 0 = no, 1 = yes
 
     SELECT CASE ( TRIM( var ) )
@@ -707,4 +716,5 @@
        CASE ( 'bio_mrt' )
           unit = 'degree_C'
+          thermal_comfort = .TRUE.  !< enable thermal_comfort if user forgot to do so
           IF ( .NOT. ALLOCATED( tmrt_grid ) )  THEN
              ALLOCATE( tmrt_grid (nys:nyn,nxl:nxr) )
@@ -714,6 +724,7 @@
        CASE ( 'bio_perct*' )
           unit = 'degree_C'
+          thermal_comfort = .TRUE.
           IF ( j == 0 ) THEN                !< if instantaneous input
-             bio_perct = .TRUE.
+             do_calculate_perct = .TRUE.
              IF ( .NOT. ALLOCATED( perct ) )  THEN
                 ALLOCATE( perct (nys:nyn,nxl:nxr) )
@@ -721,5 +732,5 @@
              ENDIF
           ELSE                              !< if averaged input
-             bio_perct_av = .TRUE.
+             do_calculate_perct_av = .TRUE.
              IF ( .NOT. ALLOCATED( perct_av ) )  THEN
                 ALLOCATE( perct_av (nys:nyn,nxl:nxr) )
@@ -730,6 +741,7 @@
        CASE ( 'bio_utci*' )
           unit = 'degree_C'
+          thermal_comfort = .TRUE.
           IF ( j == 0 ) THEN
-             bio_utci = .TRUE.
+             do_calculate_utci = .TRUE.
              IF ( .NOT. ALLOCATED( utci ) )  THEN
                 ALLOCATE( utci (nys:nyn,nxl:nxr) )
@@ -737,5 +749,5 @@
              ENDIF
           ELSE
-             bio_utci_av = .TRUE.
+             do_calculate_utci_av = .TRUE.
              IF ( .NOT. ALLOCATED( utci_av ) )  THEN
                 ALLOCATE( utci_av (nys:nyn,nxl:nxr) )
@@ -746,6 +758,7 @@
        CASE ( 'bio_pet*' )
           unit = 'degree_C'
+          thermal_comfort = .TRUE.
           IF ( j == 0 ) THEN
-             bio_pet = .TRUE.
+             do_calculate_pet = .TRUE.
              IF ( .NOT. ALLOCATED( pet ) )  THEN
                 ALLOCATE( pet (nys:nyn,nxl:nxr) )
@@ -753,5 +766,5 @@
              ENDIF
           ELSE
-             bio_pet_av = .TRUE.
+             do_calculate_pet_av = .TRUE.
              IF ( .NOT. ALLOCATED( pet_av ) )  THEN
                 ALLOCATE( pet_av (nys:nyn,nxl:nxr) )
@@ -812,4 +825,11 @@
           unit = 'illegal'
        ENDIF
+       IF ( .NOT.  humidity )  THEN
+          message_string = 'The estimation of thermal comfort requires '    // &
+                           'air humidity information, but humidity module ' // &
+                           'is disabled!'
+          CALL message( 'check_parameters', 'PA0561', 1, 2, 0, 6, 0 )
+          unit = 'illegal'
+       ENDIF
        IF ( mrt_nlevels == 0 ) THEN
           message_string = 'output of "' // TRIM( var ) // '" require'         &
@@ -838,13 +858,5 @@
     IMPLICIT NONE
 
-!
-!--    Disabled as long as radiation model not available
-
-       IF ( thermal_comfort  .AND.  .NOT.  humidity )  THEN
-          message_string = 'The estimation of thermal comfort requires '    // &
-                           'air humidity information, but humidity module ' // &
-                           'is disabled!'
-          CALL message( 'bio_check_parameters', 'PA0561', 1, 2, 0, 6, 0 )
-       ENDIF
+
 
  END SUBROUTINE bio_check_parameters
@@ -904,10 +916,12 @@
               IF ( av == 0 )  THEN
                  IF ( mrt_include_sw )  THEN
-                    local_pf(i,j,k) = ((human_absorb * mrtinsw(l) +            &
-                    human_emiss * mrtinlw(l)) /                                &
-                    (human_emiss * sigma_sb)) ** .25_wp - degc_to_k
+                    local_pf(i,j,k) = ( ( human_absorb * mrtinsw(l) +          &
+                                    mrtinlw(l) ) /               &  ! human_emiss * mrtinlw(l) ) /
+                                    ( human_emiss * sigma_sb ) ) ** .25_wp -   &
+                                    degc_to_k
                  ELSE
-                    local_pf(i,j,k) = (human_emiss * mrtinlw(l) /              &
-                                       sigma_sb) ** .25_wp - degc_to_k
+                    local_pf(i,j,k) = ( mrtinlw(l)  /          &  ! ( (human_emiss * mrtinlw(l) ) /
+                                    ( human_emiss * sigma_sb ) ) ** .25_wp -   &
+                                    degc_to_k
                  ENDIF
               ELSE
@@ -1056,9 +1070,9 @@
                   IF ( mrt_include_sw )  THEN
                      local_pf(i,j,k) = REAL( ( ( human_absorb * mrtinsw(l) +   &
-                                    human_emiss * mrtinlw(l) ) /               &
+                                    mrtinlw(l) ) /               &  ! human_emiss * mrtinlw(l) ) /
                                     ( human_emiss * sigma_sb ) ) ** .25_wp -   &
                                     degc_to_k, KIND = sp )
                   ELSE
-                     local_pf(i,j,k) = REAL( ( ( human_emiss * mrtinlw(l) ) /  &
+                     local_pf(i,j,k) = REAL( ( mrtinlw(l) /  &  ! REAL( ( ( human_emiss * mrtinlw(l) ) /
                                     ( human_emiss * sigma_sb ) ) ** .25_wp -   &
                                     degc_to_k, KIND = sp )
@@ -1179,5 +1193,4 @@
 !   (gravimetric center of sample human)
 
-    time_bio_results = 0.0_wp
     bio_cell_level = 0_iwp
     bio_output_height = 0.5_wp * dz(1)
@@ -1467,5 +1480,4 @@
 
     ELSE
-
 !
 !-- Calculate biometeorology MRT from local radiation fluxes calculated by RTM and assign
@@ -1485,9 +1497,9 @@
              IF ( mrt_include_sw )  THEN
                  tmrt_grid(j,i) = ( ( human_absorb * mrtinsw(l) +              &
-                                  human_emiss * mrtinlw(l) )  /                &
+                                  mrtinlw(l) )  /                &  ! human_emiss * mrtinlw(l) )  /
                                   ( human_emiss * sigma_sb ) ) ** .25_wp -     &
                                   degc_to_k
              ELSE
-                 tmrt_grid(j,i) = ( ( human_emiss * mrtinlw(l) )  /            &
+                 tmrt_grid(j,i) = ( mrtinlw(l)  /            &  ! ( ( human_emiss * mrtinlw(l) )  /
                                   ( human_emiss * sigma_sb ) ) ** .25_wp -     &
                                   degc_to_k
@@ -1649,5 +1661,5 @@
              clo = bio_fill_value
 
-             IF ( bio_perct .OR. bio_perct_av ) THEN
+             IF ( do_calculate_perct .OR. do_calculate_perct_av ) THEN
 !
 !--          Estimate local perceived temperature
@@ -1656,5 +1668,5 @@
              ENDIF
 
-             IF ( bio_utci  .OR. bio_utci_av ) THEN
+             IF ( do_calculate_utci  .OR. do_calculate_utci_av ) THEN
 !
 !--          Estimate local universal thermal climate index
@@ -1663,5 +1675,5 @@
              ENDIF
 
-             IF ( bio_pet .OR. bio_pet_av ) THEN
+             IF ( do_calculate_pet .OR. do_calculate_pet_av ) THEN
 !
 !--          Estimate local physiologically equivalent temperature
@@ -1674,11 +1686,11 @@
 !
 !--          Write results for selected averaged indices
-             IF ( bio_perct_av )  THEN
+             IF ( do_calculate_perct_av )  THEN
                 perct_av(j, i) = perct_ij
              END IF
-             IF ( bio_utci_av ) THEN
+             IF ( do_calculate_utci_av ) THEN
                 utci_av(j, i) = utci_ij
              END IF
-             IF ( bio_pet_av ) THEN
+             IF ( do_calculate_pet_av ) THEN
                 pet_av(j, i)  = pet_ij
              END IF
@@ -1686,11 +1698,11 @@
 !
 !--          Write result for selected indices
-             IF ( bio_perct )  THEN
+             IF ( do_calculate_perct )  THEN
                 perct(j, i) = perct_ij
              END IF
-             IF ( bio_utci ) THEN
+             IF ( do_calculate_utci ) THEN
                 utci(j, i) = utci_ij
              END IF
-             IF ( bio_pet ) THEN
+             IF ( do_calculate_pet ) THEN
                 pet(j, i)  = pet_ij
              END IF
Index: palm/trunk/SOURCE/module_interface.f90
===================================================================
--- palm/trunk/SOURCE/module_interface.f90	(revision 3738)
+++ palm/trunk/SOURCE/module_interface.f90	(revision 3739)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Removed bio_check_parameters as the method is empty.
+! 
+! 3735 2019-02-12 09:52:40Z dom_dwd_user
 ! Accepting variable j from check_parameters and passing it to 
 ! bio_check_data_output
@@ -96,5 +99,4 @@
    USE biometeorology_mod,                                                     &
        ONLY:  bio_parin,                                                       &
-              bio_check_parameters,                                            &
               bio_check_data_output,                                           &
               bio_init,                                                        &
@@ -492,5 +494,4 @@
 
 
-   IF ( biometeorology )       CALL bio_check_parameters
    IF ( bulk_cloud_model )     CALL bcm_check_parameters
    IF ( air_chemistry )        CALL chem_check_parameters
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 3738)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 3739)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Removed everything related to "time_bio_results" as this is never used.
+! 
+! 3724 2019-02-06 16:28:23Z kanani
 ! Correct double-used log_point_s unit 
 ! 
@@ -460,5 +463,5 @@
 
     USE biometeorology_mod,                                                    &
-        ONLY:  bio_calculate_thermal_index_maps, time_bio_results,             &
+        ONLY:  bio_calculate_thermal_index_maps,                               &
                thermal_comfort, uvem_calc_exposure, uv_exposure
 
@@ -1524,5 +1527,4 @@
           IF ( thermal_comfort )  THEN
              CALL bio_calculate_thermal_index_maps ( .FALSE. )
-             time_bio_results = time_since_reference_point
           ENDIF
 !
