Index: palm/trunk/SOURCE/indoor_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/indoor_model_mod.f90	(revision 4700)
+++ palm/trunk/SOURCE/indoor_model_mod.f90	(revision 4701)
@@ -25,4 +25,10 @@
 ! -----------------
 ! $Id$
+! Heat transfer for wall and windows back to USM separated into q_wall and q_win (instead q_wall_win).
+! Heat flow direction revised (heat flow positive from outside to inside).
+! New variable indoor_wall_temperature (for q_wall).
+! Removed unused quantity q_trans.
+!
+! 4698 2020-09-25 08:37:55Z maronga
 ! Fixed faulty characters
 !
@@ -308,5 +314,6 @@
     REAL(wp) ::  phi_sol                             !< [W] solar loads
     REAL(wp) ::  phi_st                              !< [W] mass specific thermal load implied non thermal mass
-    REAL(wp) ::  q_wall_win                          !< [W/m2]heat flux from indoor into wall/window
+    REAL(wp) ::  q_wall                              !< [W/m2]heat flux from indoor into wall
+    REAL(wp) ::  q_win                               !< [W/m2]heat flux from indoor into window
     REAL(wp) ::  q_waste_heat                        !< [W/m2]waste heat, sum of waste heat over the roof to Palm
 
@@ -317,5 +324,4 @@
     REAL(wp) ::  q_int                               !< [W] Energy of internal air load (for energy bilanz)
     REAL(wp) ::  q_sol                               !< [W] Energy of solar (for energy bilanz)
-    REAL(wp) ::  q_trans                             !< [W] Energy of transmission (for energy bilanz)
     REAL(wp) ::  q_vent                              !< [W] Energy of ventilation (for energy bilanz)
 
@@ -457,5 +463,5 @@
 !< Based on a Crank-Nicholson scheme with a timestep of a hour.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE im_calc_temperatures ( i, j, k, indoor_wall_window_temperature,                        &
+ SUBROUTINE im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, indoor_wall_temperature,  &
                                    near_facade_temperature, phi_hc_nd_dummy, theta_m_t_prev )
 
@@ -465,4 +471,5 @@
 
     REAL(wp) ::  indoor_wall_window_temperature  !< weighted temperature of innermost wall/window layer
+    REAL(wp) ::  indoor_wall_temperature   !< temperature of innermost wall layer evtl in im_calc_temperatures einfÃŒgen
     REAL(wp) ::  near_facade_temperature
     REAL(wp) ::  phi_hc_nd_dummy
@@ -470,5 +477,5 @@
 !
 !-- Calculation of total mass specific thermal load (internal and external)
-    phi_mtot = ( phi_m + h_t_wm * indoor_wall_window_temperature                                   &
+    phi_mtot = ( phi_m + h_t_wm * indoor_wall_temperature                                   &
                        + h_t_3  * ( phi_st + h_t_es * pt(k,j,i)                                    &
                                             + h_t_1 *                                              &
@@ -1195,4 +1202,7 @@
 
     REAL(wp) ::  indoor_wall_window_temperature   !< weighted temperature of innermost wall/window layer
+    
+    REAL(wp) ::  indoor_wall_temperature   !< temperature of innermost wall layer evtl in im_calc_temperatures einfÃŒgen
+    
     REAL(wp) ::  near_facade_temperature          !< outside air temperature 10cm away from facade
     REAL(wp) ::  second_of_day                    !< second of the current day
@@ -1319,4 +1329,5 @@
                                             surf_usm_h(l)%frac(m,ind_veg_wall) * t_wall_h(l)%val(nzt_wall,m) &
                                           + surf_usm_h(l)%frac(m,ind_wat_win)  * t_window_h(l)%val(nzt_wall,m)
+             indoor_wall_temperature = surf_usm_h(l)%frac(m,ind_veg_wall) * t_wall_h(l)%val(nzt_wall,m)
 !
 !--          Solar thermal gains. If net_sw_in larger than sun-protection threshold parameter
@@ -1356,5 +1367,5 @@
              phi_hc_nd = 0.0_wp
 
-             CALL  im_calc_temperatures ( i, j, k, indoor_wall_window_temperature,                 &
+             CALL  im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, indoor_wall_temperature, &
                                           near_facade_temperature, phi_hc_nd, buildings(nb)%theta_m_t_prev_h(fa) )
 !
@@ -1385,5 +1396,5 @@
                 phi_hc_nd    = phi_hc_nd_10
 
-                CALL  im_calc_temperatures ( i, j, k, indoor_wall_window_temperature,              &
+                CALL  im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, indoor_wall_temperature, &
                                              near_facade_temperature, phi_hc_nd, buildings(nb)%theta_m_t_prev_h(fa) )
                 theta_air_10 = theta_air                                                !< temperature with 10 W/m2 of heating
@@ -1414,5 +1425,5 @@
 !
 !--             Calculate the temperature with phi_hc_nd_ac (new)
-                CALL  im_calc_temperatures ( i, j, k, indoor_wall_window_temperature,              &
+                CALL  im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, indoor_wall_temperature, &
                                              near_facade_temperature, phi_hc_nd, buildings(nb)%theta_m_t_prev_h(fa) )
                 theta_air_ac = theta_air
@@ -1435,11 +1446,12 @@
 !--          calculate heat transfer through wall layers towards the facade
 !--          (use c_p * rho_surface to convert [W/m2] into [K m/s])
-             q_wall_win = h_t_ms * ( theta_s - theta_m )                                           &
+             q_wall = h_t_wm * ( indoor_wall_temperature - theta_m )                               &
                                     / ( facade_element_area - window_area_per_facade )
-             q_trans = q_wall_win * facade_element_area
-!
-!--          Transfer q_wall_win back to USM (innermost wall/window layer)
-             surf_usm_h(l)%iwghf_eb(m)        = q_wall_win
-             surf_usm_h(l)%iwghf_eb_window(m) = q_wall_win
+             q_win = h_t_es * ( pt(k,j,i) - theta_s )                                              &
+                                    / ( window_area_per_facade )
+!
+!--          Transfer q_wall & q_win back to USM (innermost wall/window layer)
+             surf_usm_h(l)%iwghf_eb(m)        = - q_wall
+             surf_usm_h(l)%iwghf_eb_window(m) = - q_win
 !
 !--          Sum up operational indoor temperature per kk-level. Further below, this temperature is
@@ -1549,4 +1561,5 @@
                                     surf_usm_v(l)%frac(m,ind_veg_wall) * t_wall_v(l)%val(nzt_wall,m)   &
                                   + surf_usm_v(l)%frac(m,ind_wat_win)  * t_window_v(l)%val(nzt_wall,m)
+             indoor_wall_temperature = surf_usm_v(l)%frac(m,ind_veg_wall) * t_wall_v(l)%val(nzt_wall,m) 
 
 !
@@ -1585,5 +1598,5 @@
 !--          section C.4.1 Picture C.2 zone 3)
              phi_hc_nd = 0.0_wp
-             CALL im_calc_temperatures ( i, j, k, indoor_wall_window_temperature,                  &
+             CALL im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, indoor_wall_temperature, &
                                          near_facade_temperature, phi_hc_nd, buildings(nb)%theta_m_t_prev_v(fa) )
 !
@@ -1614,5 +1627,5 @@
                 phi_hc_nd    = phi_hc_nd_10
 
-                CALL  im_calc_temperatures ( i, j, k, indoor_wall_window_temperature,              &
+                CALL  im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, indoor_wall_temperature, &
                                              near_facade_temperature, phi_hc_nd, buildings(nb)%theta_m_t_prev_v(fa) )
 
@@ -1645,5 +1658,5 @@
 !
 !--             Calculate the temperature with phi_hc_nd_ac (new)
-                CALL  im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, &
+                CALL  im_calc_temperatures ( i, j, k, indoor_wall_window_temperature, indoor_wall_temperature, &
                                              near_facade_temperature, phi_hc_nd, buildings(nb)%theta_m_t_prev_v(fa) )
                 theta_air_ac = theta_air
@@ -1664,11 +1677,12 @@
 !--          Heat flux into the wall. Value needed in urban_surface_mod to
 !--          calculate heat transfer through wall layers towards the facade
-             q_wall_win = h_t_ms * ( theta_s - theta_m )                                           &
+             q_wall = h_t_wm * ( indoor_wall_temperature - theta_m )                               &
                                     / ( facade_element_area - window_area_per_facade )
-             q_trans = q_wall_win * facade_element_area
-!
-!--          Transfer q_wall_win back to USM (innermost wall/window layer)
-             surf_usm_v(l)%iwghf_eb(m)        = q_wall_win
-             surf_usm_v(l)%iwghf_eb_window(m) = q_wall_win
+             q_win = h_t_es * ( pt(k,j,i) - theta_s )                                              &
+                                    / ( window_area_per_facade )
+!
+!--          Transfer q_wall & q_win back to USM (innermost wall/window layer)
+             surf_usm_v(l)%iwghf_eb(m)        = - q_wall
+             surf_usm_v(l)%iwghf_eb_window(m) = - q_win
 !
 !--          Sum up operational indoor temperature per kk-level. Further below, this temperature is
@@ -1794,4 +1808,7 @@
         CASE ( 'im_t_indoor_wall_win' )
            unit = 'K'
+           
+        CASE ( 'im_t_indoor_wall' )
+           unit = 'K'
 
         CASE DEFAULT
@@ -1848,5 +1865,5 @@
           grid_z = 'zu'
 
-       CASE ( 'im_t_indoor_mean', 'im_t_indoor_roof', 'im_t_indoor_wall_win')
+       CASE ( 'im_t_indoor_mean', 'im_t_indoor_roof', 'im_t_indoor_wall_win', 'indoor_wall' )
           grid_x = 'x'
           grid_y = 'y'
Index: palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4700)
+++ palm/trunk/SOURCE/urban_surface_mod.f90	(revision 4701)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! Corrected parameter 33 for building_type 2 (ground floor window emissivity
+!
+! 4698 2020-09-25 08:37:55Z maronga
 ! Bugfix in calculation of iwghf_eb and iwghf_eb_window (introduced in previous revisions)
 !
@@ -7679,5 +7682,5 @@
           0.04_wp,        &  !< parameter 31  - thermal conductivity 4th wall layer ground floor level
           0.92_wp,        &  !< parameter 32  - wall emissivity ground floor level
-          0.11_wp,        &  !< parameter 33  - window emissivity ground floor level
+          0.87_wp,        &  !< parameter 33  - window emissivity ground floor level
           0.86_wp,        &  !< parameter 34  - green emissivity ground floor level
           0.7_wp,         &  !< parameter 35  - window transmissivity ground floor level
