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

Last change on this file since 1745 was 1683, checked in by knoop, 9 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 4.5 KB
Line 
1!> @file lpm_calc_liquid_water_content.f90
2!--------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2014 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------!
18!
19! Current revisions:
20! ------------------
21!
22!
23! Former revisions:
24! -----------------
25! $Id: lpm_calc_liquid_water_content.f90 1683 2015-10-07 23:57:51Z gronemeier $
26!
27! 1682 2015-10-07 23:56:08Z knoop
28! Code annotations made doxygen readable
29!
30! 1359 2014-04-11 17:15:14Z hoffmann
31! New particle structure integrated.
32! Kind definition added to all floating point numbers.
33!
34! 1320 2014-03-20 08:40:49Z raasch
35! ONLY-attribute added to USE-statements,
36! kind-parameters added to all INTEGER and REAL declaration statements,
37! kinds are defined in new module kinds,
38! comment fields (!:) to be used for variable explanations added to
39! all variable declaration statements
40!
41! 1036 2012-10-22 13:43:42Z raasch
42! code put under GPL (PALM 3.9)
43!
44! 849 2012-03-15 10:35:09Z raasch
45! initial revision (former part of advec_particles)
46!
47!
48! Description:
49! ------------
50!> Calculate the liquid water content for each grid box.
51!------------------------------------------------------------------------------!
52 SUBROUTINE lpm_calc_liquid_water_content
53 
54
55    USE arrays_3d,                                                             &
56        ONLY:  ql, ql_v, ql_vp
57
58    USE cloud_parameters,                                                      &
59        ONLY:  rho_l
60
61    USE constants,                                                             &
62        ONLY:  pi
63
64    USE control_parameters,                                                    &
65        ONLY:  dz, message_string, rho_surface
66
67    USE cpulog,                                                                &
68        ONLY:  cpu_log, log_point_s
69
70    USE grid_variables,                                                        &
71        ONLY:  dx, dy
72
73    USE indices,                                                               &
74        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
75
76    USE kinds
77
78    USE particle_attributes,                                                   &
79        ONLY:  grid_particles, number_of_particles, particles, prt_count
80
81    IMPLICIT NONE
82
83    INTEGER(iwp) ::  i   !<
84    INTEGER(iwp) ::  j   !<
85    INTEGER(iwp) ::  k   !<
86    INTEGER(iwp) ::  n   !<
87    INTEGER(iwp) ::  psi !<
88
89    CALL cpu_log( log_point_s(45), 'lpm_calc_ql', 'start' )
90
91!
92!-- Set water content initially to zero
93    ql = 0.0_wp;  ql_v = 0.0_wp;  ql_vp = 0.0_wp
94
95!
96!-- Calculate for each grid box
97    DO  i = nxl, nxr
98       DO  j = nys, nyn
99          DO  k = nzb+1, nzt
100
101             number_of_particles = prt_count(k,j,i)
102             IF ( number_of_particles <= 0 )  CYCLE
103             particles => grid_particles(k,j,i)%particles(1:number_of_particles)
104
105!
106!--          Calculate the total volume in the boxes (ql_v, weighting factor
107!--          has to beincluded)
108             DO  n = 1, prt_count(k,j,i)
109                ql_v(k,j,i)  = ql_v(k,j,i)  + particles(n)%weight_factor *  &
110                                              particles(n)%radius**3
111             ENDDO
112
113!
114!--          Calculate the liquid water content
115             IF ( ql_v(k,j,i) /= 0.0_wp )  THEN
116                ql(k,j,i) = ql(k,j,i) + rho_l * 1.33333333_wp * pi *           &
117                                        ql_v(k,j,i) /                       &
118                                        ( rho_surface * dx * dy * dz )
119
120                IF ( ql(k,j,i) < 0.0_wp )  THEN
121                   WRITE( message_string, * )  'LWC out of range: ' , &
122                                               ql(k,j,i),i,j,k
123                   CALL message( 'lpm_calc_liquid_water_content', '', 2, 2, &
124                                 -1, 6, 1 )
125                ENDIF
126
127             ELSE
128
129                ql(k,j,i) = 0.0_wp
130
131             ENDIF
132
133          ENDDO
134       ENDDO
135    ENDDO
136
137    CALL cpu_log( log_point_s(45), 'lpm_calc_ql', 'stop' )
138
139
140 END SUBROUTINE lpm_calc_liquid_water_content
Note: See TracBrowser for help on using the repository browser.