Index: palm/trunk/SOURCE/microphysics_mod.f90
===================================================================
--- palm/trunk/SOURCE/microphysics_mod.f90	(revision 2522)
+++ palm/trunk/SOURCE/microphysics_mod.f90	(revision 2608)
@@ -25,4 +25,9 @@
 ! -----------------
 ! $Id$
+! Calculation of supersaturation in external module (diagnostic_quantities_mod).
+! Change: correct calculation of saturation specific humidity to saturation
+! mixing ratio (the factor of 0.378 vanishes).
+! 
+! 2522 2017-10-05 14:20:37Z schwenkel
 ! Minor bugfix
 ! 
@@ -548,4 +553,7 @@
            ONLY:  cpu_log, log_point_s
 
+       USE diagnostic_quantities_mod,                                          &
+           ONLY: e_s, magnus, q_s, sat, supersaturation, t_l
+
        USE indices,                                                            &
            ONLY:  nxlg, nxrg, nysg, nyng, nzb, nzt
@@ -564,19 +572,13 @@
        REAL(wp)     ::  activ             !<
        REAL(wp)     ::  afactor           !<
-       REAL(wp)     ::  alpha             !<
        REAL(wp)     ::  beta_act          !<
        REAL(wp)     ::  bfactor           !<
-       REAL(wp)     ::  e_s               !<
        REAL(wp)     ::  k_act             !<
        REAL(wp)     ::  n_act             !<
        REAL(wp)     ::  n_ccn             !<
-       REAL(wp)     ::  q_s               !<
        REAL(wp)     ::  s_0               !<
-       REAL(wp)     ::  sat               !<
        REAL(wp)     ::  sat_max           !<
        REAL(wp)     ::  sigma             !<
        REAL(wp)     ::  sigma_act         !<
-       REAL(wp)     ::  t_int             !<
-       REAL(wp)     ::  t_l               !<
 
        CALL cpu_log( log_point_s(65), 'activation', 'start' )
@@ -587,25 +589,7 @@
 
 !
-!--             Actual liquid water temperature:
-                t_l = t_d_pt(k) * pt(k,j,i)
-
-!
-!--             Calculate actual temperature
-                t_int = pt(k,j,i) * ( hyp(k) / 100000.0_wp )**0.286_wp
-!
-!--             Saturation vapor pressure at t_l:
-                e_s = 610.78_wp * EXP( 17.269_wp * ( t_l - 273.16_wp ) /    &
-                                       ( t_l - 35.86_wp )                   &
-                                     )
-!
-!--             Computation of saturation humidity:
-                q_s   = 0.622_wp * e_s / ( hyp(k) - 0.378_wp * e_s )
-                alpha = 0.622_wp * l_d_r * l_d_cp / ( t_l * t_l )
-                q_s   = q_s * ( 1.0_wp + alpha * q(k,j,i) ) /               &
-                        ( 1.0_wp + alpha * q_s )
-
-!--             Supersaturation:
-                sat   = ( q(k,j,i) - qr(k,j,i) - qc(k,j,i) ) / q_s - 1.0_wp
-
+!--             Call calculation of supersaturation located 
+!--             in diagnostic_quantities_mod
+                CALL supersaturation ( i, j, k )
 !
 !--             Prescribe parameters for activation
@@ -636,6 +620,6 @@
 !--                Curvature effect (afactor) with surface tension
 !--                parameterization by Straka (2009)
-                   sigma = 0.0761_wp - 0.000155_wp * ( t_int - 273.15_wp )
-                   afactor = 2.0_wp * sigma / ( rho_l * r_v * t_int )
+                   sigma = 0.0761_wp - 0.000155_wp * ( t_l - 273.15_wp )
+                   afactor = 2.0_wp * sigma / ( rho_l * r_v * t_l )
 !
 !--                Solute effect (bfactor)
@@ -695,4 +679,7 @@
            ONLY:  cpu_log, log_point_s
 
+       USE diagnostic_quantities_mod,                                          &
+           ONLY: e_s, magnus, q_s, sat, supersaturation, t_l
+
        USE indices,                                                            &
            ONLY:  nxlg, nxrg, nysg, nyng, nzb, nzt
@@ -709,16 +696,11 @@
        INTEGER(iwp) ::  k                 !<
 
-       REAL(wp)     ::  alpha             !<
        REAL(wp)     ::  cond              !<
        REAL(wp)     ::  cond_max          !<
        REAL(wp)     ::  dc                !<
-       REAL(wp)     ::  e_s               !<
        REAL(wp)     ::  evap              !<
        REAL(wp)     ::  evap_nc           !<
        REAL(wp)     ::  g_fac             !<
        REAL(wp)     ::  nc_0              !<
-       REAL(wp)     ::  q_s               !<
-       REAL(wp)     ::  sat               !<
-       REAL(wp)     ::  t_l               !<
        REAL(wp)     ::  temp              !<
        REAL(wp)     ::  xc                !<
@@ -730,21 +712,7 @@
              DO  k = nzb+1, nzt
 !
-!--             Actual liquid water temperature:
-                t_l = t_d_pt(k) * pt(k,j,i)
-!
-!--             Saturation vapor pressure at t_l:
-                e_s = 610.78_wp * EXP( 17.269_wp * ( t_l - 273.16_wp ) /       &
-                                       ( t_l - 35.86_wp )                      &
-                                     )
-!
-!--             Computation of saturation humidity:
-                q_s   = 0.622_wp * e_s / ( hyp(k) - 0.378_wp * e_s )
-                alpha = 0.622_wp * l_d_r * l_d_cp / ( t_l * t_l )
-                q_s   = q_s * ( 1.0_wp + alpha * q(k,j,i) ) /                  &
-                        ( 1.0_wp + alpha * q_s )
-
-!--             Supersaturation:
-                sat   = ( q(k,j,i) - qr(k,j,i) - qc(k,j,i) ) / q_s - 1.0_wp
-
+!--             Call calculation of supersaturation located 
+!--             in diagnostic_quantities_mod
+                CALL supersaturation ( i, j, k )
 !
 !--             Actual temperature:
@@ -1200,4 +1168,7 @@
            ONLY:  cpu_log, log_point_s
 
+       USE diagnostic_quantities_mod,                                          &
+           ONLY: e_s, magnus, q_s, sat, supersaturation, t_l
+
        USE indices,                                                            &
            ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt, wall_flags_0
@@ -1211,7 +1182,5 @@
        INTEGER(iwp) ::  k                 !<
 
-       REAL(wp)     ::  alpha             !<
        REAL(wp)     ::  dr                !<
-       REAL(wp)     ::  e_s               !<
        REAL(wp)     ::  evap              !<
        REAL(wp)     ::  evap_nr           !<
@@ -1224,7 +1193,4 @@
        REAL(wp)     ::  mu_r_5d2          !<
        REAL(wp)     ::  nr_0              !<
-       REAL(wp)     ::  q_s               !<
-       REAL(wp)     ::  sat               !<
-       REAL(wp)     ::  t_l               !<
        REAL(wp)     ::  temp              !<
        REAL(wp)     ::  xr                !<
@@ -1240,21 +1206,9 @@
 
                 IF ( qr(k,j,i) > eps_sb )  THEN
-!
-!--                Actual liquid water temperature:
-                   t_l = t_d_pt(k) * pt(k,j,i)
-!
-!--                Saturation vapor pressure at t_l:
-                   e_s = 610.78_wp * EXP( 17.269_wp * ( t_l - 273.16_wp ) /    &
-                                          ( t_l - 35.86_wp )                   &
-                                        )
-!
-!--                Computation of saturation humidity:
-                   q_s   = 0.622_wp * e_s / ( hyp(k) - 0.378_wp * e_s )
-                   alpha = 0.622_wp * l_d_r * l_d_cp / ( t_l * t_l )
-                   q_s   = q_s * ( 1.0_wp + alpha * q(k,j,i) ) /               &
-                           ( 1.0_wp + alpha * q_s )
-!
-!--                Supersaturation:
-                   sat   = ( q(k,j,i) - qr(k,j,i) - qc(k,j,i) ) / q_s - 1.0_wp
+
+!
+!--                Call calculation of supersaturation located 
+!--                in diagnostic_quantities_mod
+                   CALL supersaturation ( i, j, k )
 !
 !--                Evaporation needs only to be calculated in subsaturated regions
