Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 1958)
+++ palm/trunk/SOURCE/modules.f90	(revision 1960)
@@ -19,5 +19,14 @@
 ! Current revisions:
 ! ------------------
-! 
+! Separate humidity and passive scalar
+! +bc_s_t_val, diss_s_s, diss_l_s, flux_s_s, flux_l_s, s, sp, s1, s2, s3, ssws_av, 
+!  s_init, s_surf, sums_wsss_ws_l, ss, ssws, sswst, ts_m, wall_sflux
+! +constant_scalarflux, ibc_s_b, ibc_s_t, s_vertical_gradient_level_ind
+!
+! Unused variables removed
+! -gamma_x, gamma_y, gamma_z, var_x, var_y, var_z
+!
+! Change default values (in order to unify gradient calculation): 
+! pt_vertical_gradient_level, sa_vertical_gradient_level
 !
 ! Former revisions:
@@ -411,18 +420,19 @@
           dd2zu, dzu, ddzw, dzw, hyp, inflow_damping_factor, l_grid,           &
           ptdf_x, ptdf_y, p_surf, pt_surf, pt_init, qsws_surf, q_init, q_surf, &
-          rdf, rdf_sc, ref_state, sa_init, shf_surf, timenudge, time_surf,     &
-          time_vert, tmp_tnudge, ug, u_init, u_nzb_p1_for_vfc, vg, v_init,     &
-          v_nzb_p1_for_vfc, w_subs, zu, zw
+          rdf, rdf_sc, ref_state, s_init, s_surf, sa_init, shf_surf,           &
+          timenudge, time_surf, time_vert, tmp_tnudge, ug, u_init,             &
+          u_nzb_p1_for_vfc, vg, v_init, v_nzb_p1_for_vfc, w_subs, zu, zw
 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::                                   &
           c_u, c_v, c_w, diss_s_e, diss_s_nr, diss_s_pt, diss_s_q,             &
-          diss_s_qr, diss_s_sa, diss_s_u, diss_s_v, diss_s_w, dzu_mg, dzw_mg,  &
-          flux_s_e, flux_s_nr, flux_s_pt, flux_s_q, flux_s_qr, flux_s_sa,      &
-          flux_s_u, flux_s_v, flux_s_w, f1_mg, f2_mg, f3_mg,                   &
-          mean_inflow_profiles, nrs, nrsws, nrswst,                            &
+          diss_s_qr, diss_s_s, diss_s_sa, diss_s_u, diss_s_v, diss_s_w, dzu_mg,&
+          dzw_mg, flux_s_e, flux_s_nr, flux_s_pt, flux_s_q, flux_s_qr,         &
+          flux_s_s, flux_s_sa, flux_s_u, flux_s_v, flux_s_w, f1_mg, f2_mg,     &
+          f3_mg, mean_inflow_profiles, nrs, nrsws, nrswst,                     &
           ol,                                                                  & !< Obukhov length
           precipitation_amount, precipitation_rate, ptnudge, pt_slope_ref,     &
           qnudge, qs, qsws, qswst, qswst_remote, qrs, qrsws, qrswst,           &
-          saswsb, saswst, shf, tnudge, td_lsa_lpt, td_lsa_q, td_sub_lpt,       &
+          saswsb, saswst, shf, ss, ssws, sswst, tnudge, td_lsa_lpt, td_lsa_q,  &
+          td_sub_lpt,                                                          &
           td_sub_q, total_2d_a, total_2d_o, ts, tswst, ug_vert, unudge, us,    &
           usws, uswst, vnudge, vg_vert, vsws, vswst, wnudge, wsubs_vert,       &
@@ -433,8 +443,8 @@
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::                                 &
           d, de_dx, de_dy, de_dz, diss, diss_l_e,                              &
-          diss_l_nr, diss_l_pt, diss_l_q, diss_l_qr, diss_l_sa, diss_l_u,      &
-          diss_l_v, diss_l_w, flux_l_e, flux_l_nr, flux_l_pt, flux_l_q,        &
-          flux_l_qr, flux_l_sa, flux_l_u, flux_l_v, flux_l_w, kh, km,          &
-          l_wall, prr, p_loc, tend, tric,                                      &
+          diss_l_nr, diss_l_pt, diss_l_q, diss_l_qr, diss_l_s, diss_l_sa,      &
+          diss_l_u, diss_l_v, diss_l_w, flux_l_e, flux_l_nr, flux_l_pt,        &
+          flux_l_q, flux_l_qr, flux_l_s, flux_l_sa, flux_l_u, flux_l_v,        &
+          flux_l_w, kh, km, l_wall, prr, p_loc, tend, tric,                    &
           u_m_l, u_m_n, u_m_r, u_m_s, v_m_l, v_m_n, v_m_r, v_m_s, w_m_l,       &
           w_m_n, w_m_r, w_m_s
@@ -443,22 +453,20 @@
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
           e, e_p, nr, nr_p, p, prho, pt, pt_p, q, q_p, qc, ql, ql_c, ql_v,     &
-          ql_vp, qr, qr_p, rho, sa, sa_p, te_m, tnr_m, tpt_m, tq_m, tqr_m,     &
-          tsa_m, tu_m, tv_m, tw_m, u, u_p, v, v_p, vpt, w, w_p
+          ql_vp, qr, qr_p, rho, s, s_p, sa, sa_p, te_m, tnr_m, tpt_m, tq_m,    &
+          tqr_m, ts_m, tsa_m, tu_m, tv_m, tw_m, u, u_p, v, v_p, vpt, w, w_p
 #else
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
           e_1, e_2, e_3, p, prho_1, nr_1, nr_2, nr_3, pt_1, pt_2, pt_3, q_1,   &
           q_2, q_3, qc_1, ql_v, ql_vp, ql_1, ql_2, qr_1, qr_2, qr_3, rho_1,    &
-          sa_1, sa_2, sa_3, u_1, u_2, u_3, v_1, v_2, v_3, vpt_1, w_1, w_2, w_3
+          s_1, s_2, s_3, sa_1, sa_2, sa_3, u_1, u_2, u_3, v_1, v_2, v_3, vpt_1,&
+          w_1, w_2, w_3
 
     REAL(wp), DIMENSION(:,:,:), POINTER ::                                     &
           e, e_p, nr, nr_p, prho, pt, pt_p, q, q_p, qc, ql, ql_c, qr, qr_p,    &
-          rho, sa, sa_p, te_m, tnr_m, tpt_m, tq_m, tqr_m, tsa_m, tu_m, tv_m,   &
-          tw_m, u, u_p, v, v_p, vpt, w, w_p
+          rho, s, s_p, sa, sa_p, te_m, tnr_m, tpt_m, tq_m, tqr_m, ts_m,        &
+          tsa_m, tu_m, tv_m, tw_m, u, u_p, v, v_p, vpt, w, w_p
 #endif
 
     REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  rif_wall, tri
-
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: var_x, var_y, var_z, gamma_x,   &
-                                           gamma_y, gamma_z
 
 
@@ -481,4 +489,5 @@
                                               ol_av,                 & !< Avg. of Obukhov length
                                               qsws_av,               & !< Avg. of surface moisture flux
+                                              ssws_av,               & !< Avg. of surface scalar flux
                                               shf_av,                & !< Avg. of surface heat flux
                                               ts_av,                 & !< Avg. of characteristic temperature scale
@@ -631,5 +640,5 @@
                      dz_stretch_level_index, ensemble_member_nr = 0, gamma_mg, gathered_size, &
                      grid_level, ibc_e_b, ibc_p_b, ibc_p_t, &
-                     ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, &
+                     ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, ibc_s_b, ibc_s_t, &
                      ibc_sa_t, ibc_uv_b, ibc_uv_t, &
                      inflow_disturbance_begin = -1, inflow_disturbance_end = -1, &
@@ -657,4 +666,5 @@
                      pt_vertical_gradient_level_ind(10) = -9999, &
                      q_vertical_gradient_level_ind(10) = -9999, &
+                     s_vertical_gradient_level_ind(10) = -9999, &                     
                      sa_vertical_gradient_level_ind(10) = -9999, &
                      section(100,3), section_xy(100) = -9999, &
@@ -685,4 +695,5 @@
                 constant_top_momentumflux = .FALSE., &
                 constant_top_salinityflux = .TRUE., &
+                constant_scalarflux = .TRUE., &              
                 constant_waterflux = .TRUE., create_disturbances = .TRUE., &
                 data_output_2d_on_each_pe = .TRUE., & 
@@ -739,5 +750,5 @@
                  alpha_surface = 0.0_wp, atmos_ocean_sign = 1.0_wp, &
                  averaging_interval = 0.0_wp, averaging_interval_pr = 9999999.9_wp, &
-                 bc_pt_t_val, bc_q_t_val, bottom_salinityflux = 0.0_wp, &
+                 bc_pt_t_val, bc_q_t_val, bc_s_t_val, bottom_salinityflux = 0.0_wp, &
                  building_height = 50.0_wp, building_length_x = 50.0_wp, &
                  building_length_y = 50.0_wp, building_wall_left = 9999999.9_wp, &
@@ -813,5 +824,5 @@
                  mask_scale(3), &
                  pt_vertical_gradient(10) = 0.0_wp, &
-                 pt_vertical_gradient_level(10) = -9999999.9_wp, &
+                 pt_vertical_gradient_level(10) = -1.0_wp, &
                  q_vertical_gradient(10) = 0.0_wp, &
                  q_vertical_gradient_level(10) = -1.0_wp, &
@@ -819,5 +830,5 @@
                  s_vertical_gradient_level(10) = -1.0_wp, &
                  sa_vertical_gradient(10) = 0.0_wp, &
-                 sa_vertical_gradient_level(10) = -9999999.9_wp, &
+                 sa_vertical_gradient_level(10) = -1.0_wp, &
                  skip_time_domask(max_masks) = 9999999.9_wp, threshold(20) = 0.0_wp, &
                  time_domask(max_masks) = 0.0_wp, &
@@ -833,5 +844,5 @@
                  wall_humidityflux(0:4) = 0.0_wp, wall_nrflux(0:4) = 0.0_wp, &
                  wall_qflux(0:4) = 0.0_wp, wall_qrflux(0:4) = 0.0_wp, &
-                 wall_salinityflux(0:4) = 0.0_wp, wall_scalarflux(0:4) = 0.0_wp, &
+                 wall_salinityflux(0:4) = 0.0_wp, wall_sflux(0:4) = 0.0_wp, wall_scalarflux(0:4) = 0.0_wp, &
                  subs_vertical_gradient(10) = 0.0_wp, &
                  subs_vertical_gradient_level(10) = -9999999.9_wp
@@ -1255,7 +1266,8 @@
                                                   sums_wsnrs_ws_l,                &
                                                   sums_wspts_ws_l,                &
+                                                  sums_wsqs_ws_l,                 &   
+                                                  sums_wsqrs_ws_l,                &
                                                   sums_wssas_ws_l,                &
-                                                  sums_wsqs_ws_l,                 &
-                                                  sums_wsqrs_ws_l,                &
+                                                  sums_wsss_ws_l,                 &
                                                   sums_ls_l
                                               
