source: palm/trunk/SOURCE/lpm_calc_liquid_water_content.f90 @ 1320

Last change on this file since 1320 was 1320, checked in by raasch, 11 years ago

ONLY-attribute added to USE-statements,
kind-parameters added to all INTEGER and REAL declaration statements,
kinds are defined in new module kinds,
old module precision_kind is removed,
revision history before 2012 removed,
comment fields (!:) to be used for variable explanations added to all variable declaration statements

  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1 SUBROUTINE lpm_calc_liquid_water_content
2
3!--------------------------------------------------------------------------------!
4! This file is part of PALM.
5!
6! PALM is free software: you can redistribute it and/or modify it under the terms
7! of the GNU General Public License as published by the Free Software Foundation,
8! either version 3 of the License, or (at your option) any later 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-2014 Leibniz Universitaet Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22! ONLY-attribute added to USE-statements,
23! kind-parameters added to all INTEGER and REAL declaration statements,
24! kinds are defined in new module kinds,
25! comment fields (!:) to be used for variable explanations added to
26! all variable declaration statements
27!
28! Former revisions:
29! -----------------
30! $Id: lpm_calc_liquid_water_content.f90 1320 2014-03-20 08:40:49Z raasch $
31!
32! 1036 2012-10-22 13:43:42Z raasch
33! code put under GPL (PALM 3.9)
34!
35! 849 2012-03-15 10:35:09Z raasch
36! initial revision (former part of advec_particles)
37!
38!
39! Description:
40! ------------
41! Calculate the liquid water content for each grid box.
42!------------------------------------------------------------------------------!
43
44    USE arrays_3d,                                                             &
45        ONLY:  ql, ql_v, ql_vp
46
47    USE cloud_parameters,                                                      &
48        ONLY:  rho_l
49
50    USE constants,                                                             &
51        ONLY:  pi
52
53    USE control_parameters,                                                    &
54        ONLY:  dz, message_string, rho_surface
55
56    USE cpulog,                                                                &
57        ONLY:  cpu_log, log_point_s
58
59    USE grid_variables,                                                        &
60        ONLY:  dx, dy
61
62    USE indices,                                                               &
63        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
64
65    USE kinds
66
67    USE particle_attributes,                                                   &
68        ONLY:  particles, prt_count, prt_start_index
69
70    IMPLICIT NONE
71
72    INTEGER(iwp) ::  i   !:
73    INTEGER(iwp) ::  j   !:
74    INTEGER(iwp) ::  k   !:
75    INTEGER(iwp) ::  n   !:
76    INTEGER(iwp) ::  psi !:
77
78
79    CALL cpu_log( log_point_s(45), 'lpm_calc_ql', 'start' )
80
81!
82!-- Set water content initially to zero
83    ql = 0.0;  ql_v = 0.0;  ql_vp = 0.0
84
85!
86!-- Calculate for each grid box
87    DO  i = nxl, nxr
88       DO  j = nys, nyn
89          DO  k = nzb, nzt+1
90
91!
92!--          Calculate the total volume in the boxes (ql_v, weighting factor
93!--          has to beincluded)
94             psi = prt_start_index(k,j,i)
95             DO  n = psi, psi+prt_count(k,j,i)-1
96                ql_v(k,j,i)  = ql_v(k,j,i)  + particles(n)%weight_factor *  &
97                                              particles(n)%radius**3
98             ENDDO
99
100!
101!--          Calculate the liquid water content
102             IF ( ql_v(k,j,i) /= 0.0 )  THEN
103                ql(k,j,i) = ql(k,j,i) + rho_l * 1.33333333 * pi *           &
104                                        ql_v(k,j,i) /                       &
105                                        ( rho_surface * dx * dy * dz )
106
107                IF ( ql(k,j,i) < 0.0 ) THEN
108                   WRITE( message_string, * )  'LWC out of range: ' , &
109                                               ql(k,j,i)
110                   CALL message( 'lpm_calc_liquid_water_content', '', 2, 2, &
111                                 -1, 6, 1 )
112                ENDIF
113
114             ELSE
115
116                ql(k,j,i) = 0.0
117
118             ENDIF
119
120          ENDDO
121       ENDDO
122    ENDDO
123
124    CALL cpu_log( log_point_s(45), 'lpm_calc_ql', 'stop' )
125
126
127 END SUBROUTINE lpm_calc_liquid_water_content
Note: See TracBrowser for help on using the repository browser.