source: palm/trunk/SOURCE/interaction_droplets_ptq.f90 @ 3385

Last change on this file since 3385 was 3274, checked in by knoop, 6 years ago

Modularization of all bulk cloud physics code components

  • Property svn:keywords set to Id
File size: 5.4 KB
Line 
1!> @file interaction_droplets_ptq.f90
2!------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 1997-2018 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: interaction_droplets_ptq.f90 3274 2018-09-24 15:42:55Z knoop $
27! Modularization of all bulk cloud physics code components
28!
29! 3040 2018-05-25 10:22:08Z schwenkel
30! Changed the name specific humidity to mixing ratio
31!
32! 2718 2018-01-02 08:49:38Z maronga
33! Corrected "Former revisions" section
34!
35! 2696 2017-12-14 17:12:51Z kanani
36! Change in file header (GPL part)
37!
38! 2233 2017-05-30 18:08:54Z suehring
39!
40! 2232 2017-05-30 17:47:52Z suehring
41! Adjustments to new topography concept
42!
43! 2000 2016-08-20 18:09:15Z knoop
44! Forced header and separation lines into 80 columns
45!
46! 1873 2016-04-18 14:50:06Z maronga
47! Module renamed (removed _mod)
48!
49!
50! 1850 2016-04-08 13:29:27Z maronga
51! Module renamed
52!
53!
54! 1845 2016-04-08 08:29:13Z raasch
55! nzb_2d replaced by nzb_s_inner
56!
57! 1822 2016-04-07 07:49:42Z hoffmann
58! Unused variables removed.
59!
60! 1779 2016-03-03 08:01:28Z raasch
61! bugfix: module procedure names shortened to avoid Intel compiler warnings
62! about too long names
63!
64! 1682 2015-10-07 23:56:08Z knoop
65! Code annotations made doxygen readable
66!
67! 1320 2014-03-20 08:40:49Z raasch
68! ONLY-attribute added to USE-statements,
69! kind-parameters added to all INTEGER and REAL declaration statements,
70! kinds are defined in new module kinds,
71! revision history before 2012 removed,
72! comment fields (!:) to be used for variable explanations added to
73! all variable declaration statements
74!
75! 1036 2012-10-22 13:43:42Z raasch
76! code put under GPL (PALM 3.9)
77!
78! 799 2011-12-21 17:48:03Z franke
79! Bugfix: d_exner(k) was missing in calculation of pt_p
80!
81! RCS Log replace by Id keyword, revision history cleaned up
82!
83! Revision 1.1  2005/06/26 19:57:47  raasch
84! Initial revision
85!
86!
87! Description:
88! ------------
89!> Release of latent heat and change of mixing ratio due to condensation /
90!> evaporation of droplets.
91!------------------------------------------------------------------------------!
92 MODULE interaction_droplets_ptq_mod
93 
94
95    USE arrays_3d,                                                             &
96        ONLY:  pt_p, ql_c, q_p, d_exner
97
98    USE basic_constants_and_equations_mod,                                     &
99        ONLY:  lv_d_cp
100
101    USE indices,                                                               &
102        ONLY:  nxl, nxr, nyn, nys, nzb, nzt, wall_flags_0
103
104    USE kinds
105
106    USE pegrid
107
108    PRIVATE
109    PUBLIC interaction_droplets_ptq
110
111    INTERFACE interaction_droplets_ptq
112!
113!--    Internal names shortened in order ro avoid Intel compiler messages
114!--    about too long names
115       MODULE PROCEDURE i_droplets_ptq
116       MODULE PROCEDURE i_droplets_ptq_ij
117    END INTERFACE interaction_droplets_ptq
118 
119 CONTAINS
120
121
122!------------------------------------------------------------------------------!
123! Description:
124! ------------
125!> Call for all grid points
126!------------------------------------------------------------------------------!
127    SUBROUTINE i_droplets_ptq
128
129       IMPLICIT NONE
130
131       INTEGER(iwp) ::  i    !< running index x direction
132       INTEGER(iwp) ::  j    !< running index y direction
133       INTEGER(iwp) ::  k    !< running index z direction
134
135       REAL(wp) ::  flag     !< flag to mask topography grid points
136 
137       DO  i = nxl, nxr
138          DO  j = nys, nyn
139             DO  k = nzb+1, nzt
140!
141!--             Predetermine flag to mask topography
142                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
143
144                q_p(k,j,i)  = q_p(k,j,i)  - ql_c(k,j,i) * flag
145                pt_p(k,j,i) = pt_p(k,j,i) + lv_d_cp * ql_c(k,j,i) * d_exner(k) &
146                                                        * flag
147             ENDDO
148          ENDDO
149       ENDDO
150
151    END SUBROUTINE i_droplets_ptq
152
153
154!------------------------------------------------------------------------------!
155! Description:
156! ------------
157!> Call for grid point i,j
158!------------------------------------------------------------------------------!
159    SUBROUTINE i_droplets_ptq_ij( i, j )
160
161       IMPLICIT NONE
162
163       INTEGER(iwp) ::  i    !< running index x direction
164       INTEGER(iwp) ::  j    !< running index y direction
165       INTEGER(iwp) ::  k    !< running index z direction
166
167       REAL(wp) ::  flag     !< flag to mask topography grid points
168
169
170       DO  k = nzb+1, nzt
171!
172!--       Predetermine flag to mask topography
173          flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
174
175          q_p(k,j,i)  = q_p(k,j,i)  - ql_c(k,j,i) * flag
176          pt_p(k,j,i) = pt_p(k,j,i) + lv_d_cp * ql_c(k,j,i) * d_exner(k) * flag
177       ENDDO
178
179    END SUBROUTINE i_droplets_ptq_ij
180
181 END MODULE interaction_droplets_ptq_mod
Note: See TracBrowser for help on using the repository browser.